/* ==========================================================================
   LAKSHMI SALES - Responsive Enterprise Layout & UI System
   Liquid Glassmorphism Architecture for Mobile, Tablet & Desktop
   ========================================================================== */

/* Main Layout Grid */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
  width: 100%;
}

/* Sidebar Styles */
.sidebar {
  width: 270px;
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-header {
  padding: 1.25rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border-bottom: 1px solid var(--border-glass);
}

.sidebar-logo {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
  font-weight: 800;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.sidebar-brand-name {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-tagline {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-section-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  padding: 0.75rem 0.75rem 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  user-select: none;
}

.nav-item:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
  border-color: var(--border-glass);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(236, 72, 153, 0.15));
  color: #ffffff;
  border-color: var(--border-glass-glow);
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

.nav-item i {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
  color: var(--primary);
  transition: transform var(--transition-fast);
}

.nav-item.active i {
  color: #a5b4fc;
}

.sidebar-footer {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-profile-widget {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  overflow: hidden;
}

.user-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #06b6d4, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  color: white;
}

/* Sidebar Backdrop on Mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999;
}

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

/* Main Content Area */
.main-content {
  margin-left: 270px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: calc(100% - 270px);
  transition: margin var(--transition-smooth);
}

/* Top App Header */
.top-header {
  height: 70px;
  padding: 0 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0;
  z-index: 90;
  gap: 1rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.mobile-menu-btn,
.menu-toggle-btn {
  display: flex;
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  background: var(--bg-surface);
  color: var(--text-main);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.mobile-menu-btn:hover,
.menu-toggle-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--primary);
  color: var(--primary);
  transform: scale(1.04);
}

.header-title-block {
  min-width: 0;
}

.header-title-block h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-title-block p {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.btn-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-glass-glow);
  transform: translateY(-2px);
}

/* Content Viewport */
.content-viewport {
  padding: 1.75rem;
  flex: 1;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  border: 1px solid transparent;
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #ffffff;
  box-shadow: 0 4px 15px var(--primary-glow);
}

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

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

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-glass-glow);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  box-shadow: 0 4px 15px var(--success-glow);
}

.btn-sm {
  padding: 0.38rem 0.75rem;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-main);
  font-size: 0.9rem;
  font-family: inherit;
  line-height: 1.5;
  transition: all var(--transition-fast);
  box-sizing: border-box;
}

select.form-control {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a5b4fc' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 1rem;
  padding-right: 2.5rem !important;
  padding-top: 0.65rem !important;
  padding-bottom: 0.65rem !important;
  min-height: 44px;
  line-height: 1.4 !important;
  cursor: pointer;
}

select.form-control option {
  background-color: #121829 !important;
  color: #f8fafc !important;
  padding: 8px 12px;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: var(--bg-surface-hover);
}

/* Grid System */
.grid {
  display: grid;
  gap: 1.25rem;
}

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Data Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y pinch-zoom;
  border-radius: var(--radius-md);
  margin-bottom: 0.5rem;
  scrollbar-width: thin;
}

.custom-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.86rem;
  table-layout: auto;
}

.custom-table th {
  background: var(--bg-surface-hover);
  padding: 0.75rem 0.85rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-glass);
  white-space: nowrap;
}

.custom-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-glass);
  color: var(--text-main);
  vertical-align: middle;
  white-space: nowrap;
}

.custom-table tr:hover td {
  background: rgba(99, 102, 241, 0.06);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-info {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* ==========================================================================
   Enterprise Grade Pagination Component (Dark & Light Theme)
   ========================================================================== */
.enterprise-pagination-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 1.15rem;
  margin-top: 0.85rem;
  border-top: 1px solid var(--border-glass);
  font-size: 0.84rem;
  color: var(--text-muted);
}

.pagination-info {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 500;
  user-select: none;
}

.pagination-info strong {
  color: var(--text-main);
  font-weight: 700;
}

.pagination-page-indicator {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-left: 0.25rem;
}

.pagination-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.15rem;
}

.pagination-size-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  user-select: none;
}

.pagination-select {
  background: var(--input-bg);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.32rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.pagination-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.pagination-select option {
  background: var(--bg-secondary);
  color: var(--text-main);
}

[data-theme="light"] .pagination-select option {
  background: #ffffff;
  color: #0f172a;
}

.pagination-nav-group {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--bg-surface);
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 32px;
  height: 32px;
  padding: 0 0.55rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary);
  border-color: rgba(99, 102, 241, 0.3);
}

.pagination-btn.active {
  background: var(--primary) !important;
  color: #ffffff !important;
  font-weight: 800;
  border-color: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
}

.pagination-btn:disabled,
.pagination-btn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
  color: var(--text-dim);
}

.pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 32px;
  color: var(--text-dim);
  font-weight: 700;
  user-select: none;
}

@media (max-width: 768px) {
  .enterprise-pagination-container {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }
  .pagination-actions {
    justify-content: space-between;
    width: 100%;
  }
  .pagination-nav-group {
    overflow-x: auto;
    max-width: 100%;
  }
}

/* Modal Dialogs */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
  box-sizing: border-box;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass-glow);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow), 0 0 40px var(--primary-glow);
  width: 100%;
  max-width: 880px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform var(--transition-normal);
  overflow: hidden;
  box-sizing: border-box;
}

.modal-backdrop.show .modal-container {
  transform: scale(1);
}

.modal-header {
  padding: 1.15rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-glass);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y pinch-zoom;
  flex: 1;
  box-sizing: border-box;
}

.modal-footer {
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  border-top: 1px solid var(--border-glass);
  background: var(--bg-surface);
  flex-shrink: 0;
}

/* Toast Notification - Top Fixed Industry Standard */
.toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-width: 90vw;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #ffffff !important;
  padding: 0.75rem 1.15rem;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(56, 189, 248, 0.2);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: toastSlideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 0.88rem;
  font-weight: 600;
}

.toast span {
  color: #ffffff !important;
}

@keyframes toastSlideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ==========================================================================
   DOCUMENT & FORM ITEMS TABLE AUTO-SCALING STYLES
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
}

.items-input-table {
  width: 100%;
  min-width: 680px;
  border-collapse: separate;
  border-spacing: 0 0.5rem;
}

.items-input-table th {
  padding: 0.5rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-glass);
}

.items-input-table td {
  padding: 0.35rem 0.45rem;
  vertical-align: top;
}

.items-input-table input.form-control,
.items-input-table select.form-control {
  height: 38px;
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  min-width: 75px;
}

.items-input-table .col-prod { min-width: 190px; width: 28%; }
.items-input-table .col-hsn { min-width: 95px; width: 13%; text-align: center; }
.items-input-table .col-qty { min-width: 75px; width: 10%; text-align: right; }
.items-input-table .col-unit { min-width: 75px; width: 10%; text-align: center; }
.items-input-table .col-rate { min-width: 100px; width: 15%; text-align: right; }
.items-input-table .col-amount { min-width: 105px; width: 18%; text-align: right; }
.items-input-table .col-action { min-width: 44px; width: 6%; text-align: center; vertical-align: top; padding-top: 0.35rem; }

.items-input-table .col-action button,
.items-input-table .col-action .btn {
  height: 38px;
  width: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  cursor: pointer;
  transition: var(--transition-fast);
}

.items-input-table .col-action button:hover,
.items-input-table .col-action .btn:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #ffffff;
  transform: scale(1.05);
}

.items-input-table input.text-right { text-align: right; }
.items-input-table input.text-center { text-align: center; }

/* ==========================================================================
   DESKTOP COLLAPSIBLE SIDEBAR & MINI MODE (Screen > 992px)
   ========================================================================== */
@media (min-width: 993px) {
  .sidebar {
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }
  
  .main-content {
    transition: margin-left 0.3s cubic-bezier(0.16, 1, 0.3, 1), width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  body.sidebar-collapsed .sidebar,
  .app-container.sidebar-collapsed .sidebar,
  .sidebar.collapsed {
    width: 76px;
  }

  body.sidebar-collapsed .main-content,
  .app-container.sidebar-collapsed .main-content {
    margin-left: 76px;
    width: calc(100% - 76px);
  }

  body.sidebar-collapsed .sidebar-header,
  .app-container.sidebar-collapsed .sidebar-header,
  .sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 1.25rem 0.5rem;
  }

  body.sidebar-collapsed .sidebar-brand-info,
  .app-container.sidebar-collapsed .sidebar-brand-info,
  .sidebar.collapsed .sidebar-brand-info,
  body.sidebar-collapsed .nav-section-title,
  .app-container.sidebar-collapsed .nav-section-title,
  .sidebar.collapsed .nav-section-title,
  body.sidebar-collapsed .nav-item span,
  .app-container.sidebar-collapsed .nav-item span,
  .sidebar.collapsed .nav-item span,
  body.sidebar-collapsed .user-profile-info,
  .app-container.sidebar-collapsed .user-profile-info,
  .sidebar.collapsed .user-profile-info {
    display: none !important;
  }

  body.sidebar-collapsed .nav-item,
  .app-container.sidebar-collapsed .nav-item,
  .sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0.75rem 0;
    gap: 0;
    position: relative;
  }

  body.sidebar-collapsed .nav-item i,
  .app-container.sidebar-collapsed .nav-item i,
  .sidebar.collapsed .nav-item i {
    font-size: 1.25rem;
    width: auto;
    margin: 0 auto;
  }

  body.sidebar-collapsed .sidebar-footer,
  .app-container.sidebar-collapsed .sidebar-footer,
  .sidebar.collapsed .sidebar-footer {
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.85rem 0.5rem;
    align-items: center;
  }

  body.sidebar-collapsed .user-profile-widget,
  .app-container.sidebar-collapsed .user-profile-widget,
  .sidebar.collapsed .user-profile-widget {
    justify-content: center;
    width: 100%;
  }

  .sidebar .sidebar-close-btn {
    display: none !important;
  }
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS (Mobile, Tablet, Desktop)
   ========================================================================== */

@media (max-width: 1200px) {
  .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
    width: 270px !important;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }
  .grid-cols-3 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }
  .content-viewport {
    padding: 1.25rem;
  }
  .sidebar .sidebar-close-btn {
    display: flex !important;
  }
}

@media (max-width: 768px) {
  .top-header {
    padding: 0 0.85rem;
    height: 60px;
  }
  .header-title-block h1 {
    font-size: 1rem;
  }
  .header-title-block p {
    display: none;
  }
  .d-none-mobile {
    display: none !important;
  }
  
  /* Mobile Single Input Field Per Row in all Modals & Forms */
  .grid-cols-4,
  .grid-cols-3,
  .grid-cols-2,
  .modal-container .grid,
  .modal-body .grid,
  form .grid,
  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 0.85rem !important;
  }

  .content-viewport {
    padding: 0.75rem;
  }
  .modal-backdrop {
    padding: 0.35rem;
  }
  .modal-container {
    width: 100vw !important;
    max-width: 100vw !important;
    max-height: 98vh !important;
    border-radius: var(--radius-md);
    margin: 0;
  }
  .modal-header {
    padding: 0.85rem 1rem;
  }
  .modal-body {
    padding: 0.85rem;
  }
  .modal-footer {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .modal-footer button,
  .modal-body form > div:last-child button[type="submit"],
  .modal-body form > div:last-child button[type="button"] {
    width: 100%;
  }
  .modal-body .btn-sm,
  .modal-body [style*="display: flex"] button {
    width: auto;
    flex: 1 1 auto;
  }
  .toast-container {
    top: 1rem;
    bottom: auto;
    right: 0.75rem;
    left: 0.75rem;
    align-items: center;
  }
  .toast {
    width: 100%;
    justify-content: flex-start;
  }

  /* Mobile Backup & Restore Suite button alignment and card responsiveness */
  .backup-btn-group {
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.65rem !important;
  }
  .backup-btn-group .btn,
  .backup-btn-group label.btn,
  .backup-btn-group button,
  .backup-btn-group label {
    width: 100% !important;
    flex: none !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 0.75rem 1rem !important;
    font-size: 0.88rem !important;
    min-height: 44px !important;
    white-space: normal !important;
    text-align: center !important;
    box-sizing: border-box !important;
  }
  .backup-grid {
    grid-template-columns: 1fr !important;
  }
  .backup-view .glass-panel {
    padding: 1rem !important;
  }

  /* Payment Voucher & Modal Action Buttons Mobile Responsiveness (Fix Image 3 Button Overflow) */
  .payment-modal-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    justify-content: stretch !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .payment-modal-actions .payment-modal-btn {
    flex: 1 1 auto !important;
    min-width: 90px !important;
    text-align: center !important;
    padding: 0.65rem 0.75rem !important;
    font-size: 0.82rem !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
  }
  #printablePaymentReceipt {
    padding: 15px 12px !important;
    font-size: 11px !important;
  }
  #printablePaymentReceipt > div:first-child {
    font-size: 14px !important;
  }

  /* PO and All Modal Footer Buttons Mobile Wrap */
  .po-modal-footer-actions,
  .modal-footer-actions {
    flex-direction: column-reverse !important;
    align-items: stretch !important;
    gap: 0.6rem !important;
    padding-top: 0.85rem !important;
    margin-top: 0.85rem !important;
  }
  .po-modal-footer-actions > div,
  .modal-footer-actions > div,
  .modal-footer-actions-left,
  .modal-footer-actions-right {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    margin-left: 0 !important;
    gap: 0.5rem !important;
  }
  .po-modal-footer-actions button,
  .po-modal-footer-actions > div button,
  .modal-footer-actions button,
  .modal-footer-actions-left button,
  .modal-footer-actions-right button,
  .modal-footer-actions .btn,
  .modal-container form > div:last-child button,
  .modal-body form > div:last-child button {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    flex: none !important;
    text-align: center !important;
    justify-content: center !important;
    padding: 0.65rem 0.85rem !important;
    font-size: 0.88rem !important;
    white-space: normal !important;
    box-sizing: border-box !important;
  }

  .payment-type-toggle-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Modal Footer Actions - Desktop & Base */
.modal-footer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-glass, rgba(255, 255, 255, 0.1));
  padding-top: 1rem;
  margin-top: 1.25rem;
  gap: 0.75rem;
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
}

.modal-footer-actions-left {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.modal-footer-actions-right {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
  margin-left: auto;
}

.payment-type-toggle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  width: 100%;
}

/* ==========================================================================
   Universal Searchable Party Picker (Mobile Bottom Sheet & Desktop Dialog)
   ========================================================================== */
.party-picker-wrapper {
  position: relative;
  width: 100%;
}

.party-picker-trigger {
  width: 100%;
  min-height: 42px;
  padding: 6px 12px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm, 8px);
  color: var(--text-main, #f8fafc);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.party-picker-trigger:hover,
.party-picker-trigger:focus {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.08);
  outline: none;
}

.party-picker-trigger-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.party-picker-icon-box {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.party-picker-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.party-picker-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-main, #fff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.party-picker-sub {
  font-size: 0.72rem;
  color: var(--text-muted, #94a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.party-picker-trigger-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.party-picker-badge {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

.party-picker-badge.payable {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.party-picker-badge.receivable {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.party-picker-badge.zero {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim, #64748b);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.party-picker-arrow {
  font-size: 0.75rem;
  color: var(--text-dim, #94a3b8);
}

/* Modal Overlay & Bottom Sheet */
.party-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 10500;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.party-picker-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.party-picker-sheet {
  width: 100%;
  max-height: 85vh;
  background: #0f172a;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px 20px 0 0;
  transform: translateY(100%);
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.85);
  box-sizing: border-box;
}

.party-picker-overlay.show .party-picker-sheet {
  transform: translateY(0);
}

@media (min-width: 769px) {
  .party-picker-overlay {
    align-items: center;
  }
  .party-picker-sheet {
    width: 92%;
    max-width: 580px;
    max-height: 80vh;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    transform: scale(0.92);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9);
  }
  .party-picker-overlay.show .party-picker-sheet {
    transform: scale(1);
  }
}

.party-picker-handle {
  width: 44px;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  margin: 10px auto 4px auto;
  flex-shrink: 0;
}

.party-picker-header {
  padding: 0.75rem 1.15rem 0.5rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.party-picker-header-title {
  font-size: 1.05rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main, #fff);
}

.party-picker-count-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

.party-picker-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted, #94a3b8);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.party-picker-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

.party-picker-search-container {
  padding: 0.75rem 1.15rem 0.5rem 1.15rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.party-picker-search-box {
  position: relative;
  width: 100%;
}

.party-picker-search-box i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim, #64748b);
  font-size: 0.85rem;
}

.party-picker-search-input {
  width: 100%;
  height: 40px;
  padding: 0 34px 0 36px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: #fff;
  font-size: 0.88rem;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s ease;
}

.party-picker-search-input:focus {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.05);
}

.party-picker-clear-search {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim, #64748b);
  cursor: pointer;
  padding: 4px;
  display: none;
}

.party-picker-filter-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.party-picker-chip {
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.party-picker-chip.active {
  background: #38bdf8;
  color: #0f172a;
  border-color: #38bdf8;
}

.party-picker-list {
  padding: 0.5rem 1.15rem 1.15rem 1.15rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.party-card {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.party-card:hover,
.party-card:active {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.35);
  transform: translateY(-1px);
}

.party-card.selected {
  background: rgba(56, 189, 248, 0.12);
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.15);
}

.party-card-main {
  min-width: 0;
  flex: 1;
}

.party-card-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}

.party-card-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  line-height: 1.25;
}

.party-card-type-tag {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.party-card-type-tag.vendor {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.party-card-type-tag.customer {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.party-card-sub-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.74rem;
  color: var(--text-muted, #94a3b8);
}

.party-card-sub-row span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.party-card-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

.party-card-bal-title {
  font-size: 0.68rem;
  color: var(--text-dim, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.party-card-bal-val {
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1;
}

.party-card-check {
  color: #38bdf8;
  font-size: 0.9rem;
  margin-top: 2px;
}

.party-picker-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted, #94a3b8);
  font-size: 0.85rem;
}

.party-picker-empty i {
  font-size: 2rem;
  color: var(--text-dim, #475569);
  margin-bottom: 0.5rem;
}

/* ==========================================================================
   MODERN TOGGLE SWITCH & TOOLTIPS (MENU VISIBILITY MANAGER)
   ========================================================================== */
.ui-toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.ui-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.ui-toggle-slider {
  position: relative;
  width: 44px;
  height: 24px;
  background-color: rgba(148, 163, 184, 0.25);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 24px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.ui-toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.ui-toggle-switch input:checked + .ui-toggle-slider {
  background-color: #10b981;
  border-color: #059669;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.ui-toggle-switch input:checked + .ui-toggle-slider:before {
  transform: translateX(20px);
}

.ui-toggle-switch:hover .ui-toggle-slider {
  border-color: #38bdf8;
}

[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 118%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.96);
  color: #ffffff !important;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 99999;
  border: 1px solid rgba(56, 189, 248, 0.35);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  animation: tooltipFadeIn 0.18s ease-out;
}

@keyframes tooltipFadeIn {
  from { opacity: 0; transform: translate(-50%, 4px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
