/* Advanced Tech Light Mode POS & Inventory CSS System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;600&family=Outfit:wght@400;500;600;700&display=swap');

:root {
  --font-sans: 'Inter', 'Outfit', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  /* Tech Light Palette */
  --bg-app: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-surface: #f1f5f9;
  --bg-hover: #e2e8f0;
  
  --accent-tech: #4f46e5;
  --accent-tech-hover: #4338ca;
  --accent-cyan: #0891b2;
  --accent-emerald: #059669;
  --accent-amber: #d97706;
  --accent-rose: #e11d48;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  
  --border-light: #e2e8f0;
  --border-active: #818cf8;
  
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  
  --shadow-light: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 4px 14px rgba(79, 70, 229, 0.2);
}

/* Tech Dark Palette Override */
[data-theme="dark"] {
  --bg-app: #0f172a;
  --bg-sidebar: #1e293b;
  --bg-card: #1e293b;
  --bg-surface: #334155;
  --bg-hover: #475569;
  
  --accent-tech: #6366f1;
  --accent-tech-hover: #4f46e5;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-tertiary: #64748b;
  
  --border-light: #334155;
  --border-active: #818cf8;
  
  --shadow-light: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

[data-theme="dark"] .glass-panel {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .mobile-header-bar {
  background: #1e293b;
  border-bottom-color: #334155;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar Style */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-app);
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-tech);
}

.glass-panel {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-light);
}

/* App Wrapper */
.app-wrapper {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* Mobile Header Bar (Visible <= 1024px) */
.mobile-header-bar {
  display: none;
  height: 56px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  padding: 0 1rem;
  align-items: center;
  justify-content: space-between;
  z-index: 40;
}

.mobile-menu-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
}

/* Sidebar Navigation */
.app-sidebar {
  width: 260px;
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0;
  z-index: 60;
  box-sizing: border-box;
  overflow: hidden;
  transition: transform 0.25s ease;
}

.sidebar-nav-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  margin-bottom: 0.75rem;
}

.sidebar-nav-scroll::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav-scroll::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 4px;
}

.sidebar-nav-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--accent-tech);
}

.sidebar-footer {
  border-top: 1px solid var(--border-light);
  padding-top: 0.85rem;
  background: var(--bg-sidebar);
  flex-shrink: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.brand-logo i {
  color: var(--accent-tech);
  font-size: 1.5rem;
}

.tech-tag {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  background: rgba(79, 70, 229, 0.1);
  color: var(--accent-tech);
  border: 1px solid rgba(79, 70, 229, 0.25);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 600;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 1.25rem;
  list-style: none;
}

.nav-item > a {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.9rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.12s ease;
  white-space: nowrap;
}

.nav-item > a span {
  white-space: nowrap;
}

.nav-item > a:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.nav-item.active > a {
  background: var(--accent-tech);
  color: #ffffff;
  font-weight: 600;
  box-shadow: var(--shadow-glow);
}

/* Parent Dropdown Accordion Styling */
.nav-item.has-dropdown > a {
  background: transparent;
  color: var(--text-secondary);
}

.nav-item.has-dropdown > a:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.nav-item.has-dropdown.active > a {
  background: rgba(79, 70, 229, 0.05) !important;
  color: var(--accent-tech) !important;
  font-weight: 700 !important;
  box-shadow: none !important;
  border-left: 3.5px solid var(--accent-tech);
}

/* Sub-menu Dropdown Styling */
.nav-submenu {
  list-style: none;
  padding: 0.35rem 0 0.45rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  border-left: 1.5px dashed rgba(79, 70, 229, 0.25);
  margin-left: 1.25rem;
  margin-top: 0.2rem;
}

.nav-submenu-item a {
  display: flex !important;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.8rem !important;
  color: var(--text-secondary) !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 0.83rem !important;
  font-weight: 500 !important;
  border-radius: var(--radius-xs);
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap !important;
}

.nav-submenu-item a:hover {
  background: rgba(79, 70, 229, 0.08) !important;
  color: var(--accent-tech) !important;
  transform: translateX(2px);
}

.nav-submenu-item.active a {
  background: var(--accent-tech) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35) !important;
  transform: translateX(4px);
}

.nav-submenu-item.active a i {
  color: #ffffff !important;
}

/* Sidebar Mobile Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 55;
}

/* POS Container */
.pos-container {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 420px;
  height: 100vh;
  overflow: hidden;
}

.pos-products-area {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  gap: 1.25rem;
  overflow: hidden;
  background: var(--bg-app);
}

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

.search-input-group {
  position: relative;
  flex: 1;
}

.search-input-group input {
  width: 100%;
  padding: 0.8rem 1rem 0.8rem 2.8rem;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.15s ease;
}

.search-input-group input:focus {
  border-color: var(--accent-tech);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  overflow-y: auto;
  padding-right: 0.4rem;
}

.product-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.95rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.15s ease;
  user-select: none;
  box-shadow: var(--shadow-card);
}

.product-card:hover {
  border-color: var(--accent-tech);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.12);
}

.product-card:active {
  transform: scale(0.98);
}

.product-sku {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-tech);
  margin-bottom: 0.35rem;
}

.product-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 0.75rem;
}

.product-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  border-top: 1px dashed var(--border-light);
  padding-top: 0.5rem;
}

.product-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-emerald);
}

.product-stock {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  background: var(--bg-surface);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* POS Cart Sidebar */
.pos-cart-area {
  background: #ffffff;
  border-left: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  height: 100vh;
  box-shadow: -4px 0 15px rgba(0,0,0,0.02);
}

.cart-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
}

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

.cart-items-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: var(--bg-app);
  scroll-behavior: smooth;
}

.cart-item-row {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  animation: cartSlideUp 0.2s ease-out;
}

.cart-item-info h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.cart-item-info span {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.qty-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-surface);
  padding: 0.25rem 0.45rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-light);
}

.qty-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1rem;
  cursor: pointer;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: all 0.1s;
}

.qty-btn:hover {
  background: var(--accent-tech);
  color: #ffffff;
}

.cart-summary {
  padding: 1.25rem;
  background: #ffffff;
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.summary-row.grand-total {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  border-top: 1px dashed var(--border-light);
  padding-top: 0.65rem;
  margin-top: 0.25rem;
}

.checkout-btn {
  width: 100%;
  padding: 1rem;
  background: var(--accent-emerald);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1.08rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.25);
}

.checkout-btn:hover {
  background: #047857;
  transform: translateY(-1px);
}

/* Floating Cart Toggle Button for Mobile Screens */
.mobile-cart-toggle-btn {
  display: none;
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  background: var(--accent-tech);
  color: #ffffff;
  padding: 0.85rem 1.25rem;
  border-radius: 30px;
  font-weight: 700;
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
  z-index: 45;
  border: none;
  cursor: pointer;
  align-items: center;
  gap: 0.5rem;
}

/* Utility Helpers for Responsive Views */
.hide-mobile {
  display: inline-flex;
}
.show-mobile {
  display: none;
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVE MEDIA QUERIES (Ultra-Smooth)
   ========================================================================== */

@media (max-width: 1024px) {
  .hide-mobile {
    display: none !important;
  }
  .show-mobile {
    display: inline-flex !important;
  }

  .app-wrapper {
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .mobile-header-bar {
    display: flex;
    height: 56px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-light);
    padding: 0 1rem;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  }

  [data-theme="dark"] .mobile-header-bar {
    background: #1e293b;
    border-bottom-color: #334155;
  }

  .mobile-menu-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--bg-surface);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.15s ease;
  }

  .mobile-menu-btn:active {
    background: var(--bg-hover);
    transform: scale(0.95);
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(310px, 86vw);
    height: 100vh;
    height: 100dvh;
    transform: translateX(-100%);
    box-shadow: 10px 0 35px rgba(0, 0, 0, 0.25);
    z-index: 1000;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }

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

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.25s ease;
  }

  .sidebar-overlay.active {
    display: block;
    opacity: 1;
  }

  /* POS View Layout on Mobile / Tablets */
  .pos-container {
    grid-template-columns: 1fr;
    height: calc(100vh - 56px);
    height: calc(100dvh - 56px);
    position: relative;
    overflow: hidden;
  }

  .pos-products-area {
    padding: 0.75rem;
    gap: 0.75rem;
    height: 100%;
    overflow-y: auto;
    padding-bottom: 5.5rem; /* Space for floating cart bar */
  }

  .pos-header-actions {
    padding: 0.75rem !important;
    gap: 0.6rem !important;
  }

  .search-input-group input {
    padding: 0.7rem 2.4rem 0.7rem 2.4rem !important;
    font-size: 0.9rem !important;
  }

  .pos-cart-area {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    width: 100vw !important;
    height: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    z-index: 1050 !important;
    background: #ffffff !important;
    transform: translateY(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex !important;
    flex-direction: column !important;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden !important;
  }

  [data-theme="dark"] .pos-cart-area {
    background: #1e293b !important;
  }

  .pos-cart-area.active {
    transform: translateY(0) !important;
  }

  .pos-cart-area .cart-header {
    flex: 0 0 auto !important;
    padding: 0.7rem 1rem !important;
    background: var(--bg-surface) !important;
    border-bottom: 1.5px solid var(--border-light) !important;
  }

  .pos-cart-customer-bar {
    flex: 0 0 auto !important;
    padding: 0.45rem 0.85rem !important;
  }

  .cart-items-wrapper {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 0.6rem 0.75rem !important;
    background: var(--bg-app) !important;
  }

  .pos-cart-payment-bar {
    flex: 0 0 auto !important;
    padding: 0.45rem 0.85rem !important;
    background: #fff !important;
    border-top: 1px solid var(--border-light) !important;
  }

  [data-theme="dark"] .pos-cart-payment-bar {
    background: #1e293b !important;
  }

  .pos-cart-area .cart-summary {
    flex: 0 0 auto !important;
    padding: 0.6rem 1rem !important;
    padding-bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px)) !important;
    background: #ffffff !important;
    border-top: 1.5px solid var(--border-light) !important;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.08) !important;
    gap: 0.35rem !important;
  }

  [data-theme="dark"] .pos-cart-area .cart-summary {
    background: #1e293b !important;
  }

  .pos-cart-area .summary-row {
    font-size: 0.84rem !important;
  }

  .pos-cart-area .summary-row.grand-total {
    font-size: 1.15rem !important;
    padding-top: 0.35rem !important;
    margin-top: 0.15rem !important;
  }

  .pos-cart-area .checkout-btn {
    width: 100% !important;
    padding: 0.8rem 1rem !important;
    font-size: 1.05rem !important;
    font-weight: 800 !important;
    margin-top: 0.35rem !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
  }

  #mobile-cart-close-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 0.35rem;
    background: var(--bg-app);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
  }

  /* Floating Bottom Cart Bar for Cashier */
  .mobile-cart-toggle-btn {
    display: flex !important;
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    max-width: 440px;
    margin: 0 auto;
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    color: #ffffff;
    padding: 0.85rem 1.4rem;
    border-radius: 30px;
    font-weight: 800;
    font-size: 0.95rem;
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.45);
    z-index: 900;
    border: none;
    cursor: pointer;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }

  .mobile-cart-toggle-btn:active {
    transform: scale(0.97);
  }

  /* Responsive Grids & Modals across app */
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important;
    gap: 0.65rem !important;
  }

  .product-card {
    padding: 0.75rem !important;
  }

  /* Universal Responsive Modals */
  div[id$="-modal"] {
    padding: 0.5rem !important;
    align-items: flex-end !important;
    z-index: 9999 !important;
  }

  div[id$="-modal"] > .glass-panel,
  div[id$="-modal"] > div {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92vh !important;
    max-height: 92dvh !important;
    border-radius: 16px 16px 8px 8px !important;
    padding: 1.25rem !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 768px) {
  /* Dashboard Action Buttons Grid */
  .dashboard-hero-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
    width: 100% !important;
    margin-top: 0.85rem !important;
  }

  .dashboard-hero-actions a,
  .dashboard-hero-actions button {
    width: 100% !important;
    justify-content: center !important;
    padding: 0.7rem 0.5rem !important;
    font-size: 0.82rem !important;
    text-align: center !important;
  }

  /* Dashboard KPI 2x2 Grid */
  .dashboard-kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.65rem !important;
  }

  .dashboard-kpi-grid .glass-panel {
    padding: 1rem !important;
  }

  .dashboard-kpi-grid h3 {
    font-size: 1.2rem !important;
  }

  /* Main content padding adjustment */
  div[style*="padding: 1.75rem"],
  div[style*="padding: 1.5rem 2rem"] {
    padding: 0.85rem !important;
  }

  /* Universal Grid Responsiveness for Mobile */
  div[style*="grid-template-columns: 2fr 1fr"],
  div[style*="grid-template-columns: 1fr 2fr"],
  div[style*="grid-template-columns: 3fr 1fr"],
  div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  /* Table Horizontal Scrolling on Small Screens */
  .table-responsive,
  .glass-panel > div[style*="overflow-x"],
  .glass-panel table {
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  /* Action Buttons Grid on Mobile */
  .action-buttons-wrap {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.45rem !important;
    width: 100% !important;
  }

  .action-buttons-wrap a,
  .action-buttons-wrap button {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 0.55rem 0.35rem !important;
    font-size: 0.76rem !important;
    white-space: nowrap !important;
  }

  /* Catalog Table Mobile Mode */
  #products-catalog-table th.col-barcode,
  #products-catalog-table td.col-barcode,
  #products-catalog-table th.col-category,
  #products-catalog-table td.col-category,
  #products-catalog-table th.col-stocktype,
  #products-catalog-table td.col-stocktype,
  #products-catalog-table th.col-cost,
  #products-catalog-table td.col-cost,
  #products-catalog-table th.col-expiry,
  #products-catalog-table td.col-expiry,
  #products-catalog-table th.col-entryby,
  #products-catalog-table td.col-entryby {
    display: none !important;
  }

  #products-catalog-table .mobile-only-barcode,
  #products-catalog-table .mobile-cat-pill {
    display: inline-block !important;
  }

  #products-catalog-table th,
  #products-catalog-table td {
    padding: 0.55rem 0.35rem !important;
  }

  /* Purchases Table Mobile Mode */
  #purchases-table th.col-po-date,
  #purchases-table td.col-po-date,
  #purchases-table th.col-po-paid,
  #purchases-table td.col-po-paid,
  #purchases-table th.col-po-status,
  #purchases-table td.col-po-status {
    display: none !important;
  }

  #purchases-table th,
  #purchases-table td {
    padding: 0.55rem 0.35rem !important;
  }

  /* Universal PO / Form Grids */
  .po-form-grid-2 {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 0.65rem !important;
  }

  .po-form-grid-4 {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.65rem !important;
  }
}

@media (max-width: 480px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.55rem !important;
  }

  .dashboard-kpi-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  .mobile-cart-toggle-btn {
    bottom: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    padding: 0.75rem 1.15rem;
    font-size: 0.9rem;
  }
}

/* Media Print Styling for Reports and Documents */
@media print {
  .no-print, button, nav, header, .app-sidebar, .mobile-header-bar, .action-buttons-wrap, .sidebar-overlay {
    display: none !important;
  }
  
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-family: system-ui, -apple-system, sans-serif !important;
  }

  .glass-panel {
    background: none !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }

  body.printing-thermal * {
    visibility: hidden !important;
  }
  body.printing-thermal #thermal-receipt-modal,
  body.printing-thermal #thermal-receipt-modal * {
    visibility: visible !important;
  }
  body.printing-thermal #thermal-receipt-modal {
    position: absolute;
    left: 0;
    top: 0;
    width: 80mm;
    margin: 0;
    padding: 0.5rem;
    background: #fff;
    color: #000;
  }
}
