:root {
    --primary-blue: #0067FF;
    --sidebar-bg: #1a212d;
    --sub-sidebar-bg: #293343;
    --app-bg: #d7f3ca;
    --text-dark: #161c22;
    --text-muted: #676613;
    --border-light: #96999c;
    --accent-green: #2ecc71;
    --card-shadow: 0 2px 10px rgba(0,0,0,0.05);
    --sidebar-width: 70px;
    --sub-sidebar-width: 240px;
    --radius: 8px;
  }
  /* "Courier New", Courier, */
  * { box-sizing: border-box; margin: 0; padding: 0; font-family: Consolas, "Lucida Console", monospace;  }
  body {  background-color: var(--app-bg); color: var(--text-dark); height: 100vh; display: flex; flex-direction: column; overflow: hidden; overflow-x: hidden; }
  h1 { font-size: 20px;}
  .header { height: 60px; background: #fff; border-bottom: 1px solid var(--border-light); display: flex; align-items: center; padding: 0 20px; justify-content: space-between; z-index: 100; }
  .header-left { display: flex; align-items: center; gap: 20px; flex-shrink: 0; }
  .header-center { flex: 1; display: flex; justify-content: center; padding: 0 20px; overflow-x: auto; }
  .header-right { display: flex; align-items: center; gap: 20px; flex-shrink: 0; }
  .logo { font-size: 20px; font-weight: 800; color: var(--primary-blue); letter-spacing: -1px; }
  .search-icon-btn { background: none; border: none; padding: 8px; cursor: pointer; color: var(--text-dark); border-radius: var(--radius); transition: 0.2s; display: flex; align-items: center; justify-content: center; outline: none; }
  .search-icon-btn:hover, .search-icon-btn:focus { background: #f0f3f7; color: var(--primary-blue); }
  .logout-icon-btn { background: none; border: none; padding: 8px; cursor: pointer; color: var(--text-dark); border-radius: var(--radius); transition: 0.2s; display: flex; align-items: center; justify-content: center; outline: none; }
  .logout-icon-btn:hover, .logout-icon-btn:focus { background: #fee; color: #dc3545; }
  .header-menu-toggle { display: none; background: none; border: 1px solid var(--border-light); padding: 6px 8px; border-radius: var(--radius); cursor: pointer; color: var(--text-dark); transition: 0.2s; margin-right: 10px; }
  .header-menu-toggle:hover, .header-menu-toggle:focus { background: #f0f3f7; color: var(--primary-blue); }
  
  /* Search Popup */
  .search-popup-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(26, 33, 45, 0.6); display: none; justify-content: center; align-items: flex-start; padding-top: 100px; z-index: 2000; }
  .search-popup-overlay.active { display: flex; }
  .search-popup-content { background: #fff; border-radius: var(--radius); box-shadow: 0 4px 20px rgba(0,0,0,0.2); width: 90%; max-width: 600px; animation: slideDown 0.3s ease-out; display: flex; flex-direction: column; max-height: 90vh; overflow: hidden; }
  .search-popup-header { padding: 20px 25px; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; }
  .search-popup-header h3 { margin: 0; font-size: 18px; font-weight: 600; color: var(--text-dark); }
  .search-popup-close { background: none; border: none; padding: 5px; cursor: pointer; color: var(--text-muted); border-radius: 4px; transition: 0.2s; display: flex; align-items: center; justify-content: center; outline: none; }
  .search-popup-close:hover, .search-popup-close:focus { background: #f0f3f7; color: var(--text-dark); }
  .search-popup-body { padding: 20px 25px; display: flex; flex-direction: column; gap: 15px; }
    .search-popup-input { padding: 12px 15px; border: 1px solid var(--border-light); border-radius: var(--radius); font-size: 16px; outline: none; transition: 0.2s; width: 100%; box-sizing: border-box; }
  .search-popup-input:focus { border-color: var(--primary-blue); box-shadow: 0 0 0 3px rgba(0,103,255,0.1); }
  .search-popup-results { max-height: 400px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  
  /* Horizontal Header Menu */
  .header-menu { display: flex; align-items: center; gap: 8px; list-style: none; padding: 0; margin: 0; position: relative; }
  .header-menu-item { padding: 8px 10px; border-radius: var(--radius); cursor: pointer; font-size: 14px; font-weight: 500; color: var(--text-dark); transition: 0.2s; white-space: nowrap; outline: none; display: flex; align-items: center; gap: 3px; position: relative; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
  .header-menu-item:hover, .header-menu-item:focus { background: #f0f3f7; color: var(--primary-blue); }
  .header-menu-item.active { background: var(--primary-blue); color: #fff; }
  .header-menu-item .kb-badge { font-size: 9px; background: rgba(255,255,255,0.2); padding: 2px 2px; border-radius: 3px; color: inherit; }
  .header-menu-item:not(.active) .kb-badge { background: #e0e6ed; color: #666; }
  
  .app-main { display: flex; flex: 1; overflow: hidden; position: relative; }
  
  .sidebar-primary { width: var(--sidebar-width); background: var(--sidebar-bg); display: flex; flex-direction: column; align-items: center; padding-top: 20px; gap: 15px; }
  .nav-icon { width: 45px; height: 45px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #aeb9c7; cursor: pointer; transition: 0.2s; font-size: 20px; outline: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
  .nav-icon:hover, .nav-icon:focus { background: rgba(255,255,255,0.1); color: #fff; }
  .nav-icon.active { background: var(--primary-blue); color: #fff; box-shadow: 0 4px 12px rgba(0,103,255,0.3); }
  
  .sidebar-secondary { width: var(--sub-sidebar-width); background: var(--sub-sidebar-bg); border-right: 1px solid var(--border-light); display: none; flex-direction: column; }
  .sub-header { padding: 25px 20px 15px 20px; font-size: 18px; font-weight: 700; color: #d6e8f9; }
  .menu-list { list-style: none; padding: 10px; }
  .menu-item { padding: 12px 15px; border-radius: var(--radius); margin-bottom: 4px; cursor: pointer; font-size: 14px; color: #d6e8f9; transition: 0.2s; display: flex; justify-content: space-between; align-items: center; outline: none; }
  .menu-item:hover, .menu-item:focus { background: #f0f6ff; color: var(--primary-blue); }
  .menu-item.active { background: #eef4ff; color: var(--primary-blue); font-weight: 600; }
  .kb-badge { font-size: 10px; background: #ddd; padding: 2px 6px; border-radius: 4px; color: #666; }
  
  .content-area { flex: 1; padding: 25px; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 10px; -webkit-overflow-scrolling: touch; }
  .page-header { display: flex; justify-content: space-between; align-items: center; }
  .btn-add, .btn-delete, .btn-edit, .btn-view { 
    background: var(--primary-blue); 
    color: white; 
    border: none; 
    padding: 10px 20px; 
    border-radius: var(--radius); 
    font-weight: 600; 
    cursor: pointer; 
    box-shadow: 0 4px 10px rgba(0,103,255,0.2); 
    touch-action: manipulation; 
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    outline: none;
  }
  .btn-add:hover, .btn-add:focus {
    background: #0052cc;
    box-shadow: 0 6px 15px rgba(0,103,255,0.3);
    transform: translateY(-1px);
  }
  .btn-add svg {
    width: 16px;
    height: 16px;
    display: block;
  }
  
  /* Category Module Specific Styles */
  .page-title {
    font-size: 24px;
  }
  
  .icon-inline {
    vertical-align: middle;
    margin-right: 6px;
  }
  
  .search-filters {
    padding: 12px 20px;
    display: flex;
    gap: 10px;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
  }
  
  .search-select {
    width: 200px;
  }
  
  .keyboard-help {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: bold;
  }
  
  .pagination-wrapper {
    display: flex;
    gap: 10px;
    padding: 10px 20px;
    align-items: center;
  }
  
  .page-info {
    color: var(--text-muted);
    font-weight: bold;
  }
  
  .per-page-select {
    width: 120px;
    margin-left: auto;
  }
  
  .modal-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 4px;
  }
  
  .modal-close-btn:hover,
  .modal-close-btn:focus {
    background: #f0f3f7;
    color: var(--text-dark);
  }
  
  .file-input {
    margin-bottom: 8px;
  }
  
  .image-preview-container {
    margin-top: 8px;
    display: none;
  }
  
  .image-preview-container.show {
    display: block;
  }
  
  .preview-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    display: block;
  }
  
  .image-preview-controls {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
  }
  
  .btn-remove-image {
    background: #fee;
    color: #b91c1c;
    border: 1px solid #fecaca;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    outline: none;
  }
  
.btn-remove-image:hover,
.btn-remove-image:focus {
  background: #fecaca;
  border-color: #b91c1c;
  transform: translateY(-1px);
}

/* Autocomplete Styles */
.autocomplete-container {
  position: relative;
  width: 100%;
}

.autocomplete-list {
  display: none;
  position: fixed;
  /* top/left/width set by JS so dropdown is not clipped by overflow:hidden parents */
  background: #fff;
  border: 1px solid #131313;
  border-radius: var(--radius);
  max-height: 300px;
  overflow-y: auto;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.autocomplete-list.show {
  display: block;
}

.autocomplete-item {
  padding: 10px;
  cursor: pointer;
  border-bottom: 1px solid #909090;
  transition: background 0.2s;
}
#field_categories {
  min-height: 350px;
}
#field_documents {
  min-height: 350px;
}
#contact_type {
  min-height: 50px;
}
.autocomplete-item:hover,
.autocomplete-item:focus {
  background: #f0f3f7;
}
/*
.modern-table tr.keyboard-selected {
  background:#073b3d !important;
}*/

.product-list-item.keyboard-selected {
  background: #eef3f8;
}

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

  /* Production Page Styles */
  .production-container {
    display: flex;
    gap: 20px;
    height: calc(100vh - 100px);
    overflow: hidden;
  }

  .production-container.pos-wrap {
    flex-direction: column;
    height: calc(100vh - 220px);
  }

  .production-container.pos-wrap .pos-main {
    display: flex;
    gap: 20px;
    flex: 1;
    min-height: 0;
  }

  .production-container.pos-wrap .production-left,
  .production-container.pos-wrap .production-right {
    min-height: 0;
  }

  .production-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
  }

  .production-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    overflow-y: auto;
  }

  .form-body {
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
  }

  .form-body .input-group {
    margin-bottom: 0;
  }

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

  .production-section-header {
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-light);
    background: #f8f9fa;
    border-radius: 8px;
  }

  #variantTypesContainer {
    display: flex;
    gap: 10px;
  }
  #variantTypesContainer .variant-type-card  {
    width: 300px;
    font-size: 14px;
  }

  /* Reports / Analytics */
  .reports-container { width: 95%; margin: 0 auto; padding: 20px; }
  .reports-container .page-title { margin-bottom: 24px; font-size: 1.5rem; }
  .report-section { margin-bottom: 32px; padding: 15px; }
  .report-section-title { font-size: 1.15rem; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border-light); }
  .report-filters .filter-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
  .report-filters .input-group { min-width: 140px; }
  .report-filters .filter-actions .btn-add { margin-top: 0; }
  .report-table-wrap { overflow-x: auto; margin: 16px 0; }
  .report-table-wrap .modern-table { min-width: 600px; }
  .report-filters-toggle { display: none; justify-content: flex-end; padding: 6px 0 10px; }
  .report-filters-toggle .search-icon-btn { border: 1px solid var(--border-light); background: #fff; }
  @media (max-width: 768px) {
    .report-filters .filter-row { flex-direction: column; align-items: stretch; }
    .report-filters .input-group { min-width: 0; }
    .report-filters-toggle { display: flex; }
    .report-section.filters-collapsed .report-filters { display: none; }
  }

  .production-section-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
  }

  .pos-tax-discount-grid {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(320px, 1.3fr);
    gap: 16px;
    align-items: start;
  }

  .pos-tax-discount-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .pos-tax-discount-applied {
    overflow: auto;
    padding-bottom: 4px;
  }

  .pos-tax-discount-applied .modern-table {
    width: 100%;
  }

  .pos-inline-fields {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
    align-items: center;
  }

  .pos-inline-fields .search-bar {
    flex: 1 1 180px;
    min-width: 140px;
  }

  .pos-inline-fields .btn-apply-icon {
    flex: 0 0 auto;
  }

  .btn-apply-icon {
    background: #6e6e6e;
    color: #ffffff;
    border: none;
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    outline: none;
  }

  .btn-apply-icon:hover,
  .btn-apply-icon:focus {
    background: #4b4b4b;
    transform: translateY(-1px);
  }

  .btn-clear-icon {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 8px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    outline: none;
  }
  .direct-header-links-wrap {
      display: flex;
      gap: 24px;
  }
  .direct-header-links-wrap a {
    text-decoration: none;
    background: #f0f3f7;
    align-items: center;
    gap: 4px;
    padding: 10px 8px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 16px;
    font-weight: bold;
    border-radius: var(--radius); 
    white-space: nowrap;
  }
  .direct-header-links-wrap a kbd {
    font-size: 12px;
    padding: 2px 4px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 4px;
    color: var(--text-muted);
    font-family: inherit;
  }
  .btn-clear-icon:hover,
  .btn-clear-icon:focus {
    background: #fee2e2;
    border-color: #fecaca;
    color: #b91c1c;
    transform: translateY(-1px);
  }

  .pos-sales-order-hint {
    margin-top: 6px;
    font-size: 12px;
    color: #475569;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 6px 10px;
  }

  .pos-pending-hint {
    margin-top: 6px;
    font-size: 14px;
    color: #475569;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 6px 10px;
    max-width: 200px;
  }

  .pos-tax-discount-applied .modern-table th,
  .pos-tax-discount-applied .modern-table td {
    padding: 6px 10px;
    font-size: 14px;
  }

  .pos-tax-discount-applied .modern-table td {
    font-weight: 600;
  }

  .pos-tax-discount-applied .pos-icon-btn {
    background: #6e6e6e;
    color: #ffffff;
    border: none;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
  }

  .pos-tax-discount-applied .pos-icon-btn:hover,
  .pos-tax-discount-applied .pos-icon-btn:focus {
    background: #4b4b4b;
    transform: translateY(-1px);
  }

  .pos-summary-footer {
    margin-top: 10px;
    padding: 12px 16px;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    background: #f8f9fa;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    align-items: center;
    flex-shrink: 0;
  }

  .pos-summary-footer .page-info {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
  }

  .pos-confirm-modal .modal-header {
    background: #f8fafc;
  }

  .pos-confirm-body {
    padding: 20px;
    background: #f5f7fb;
  }

  .pos-confirm-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .pos-confirm-section {
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 14px;
  }

  .pos-confirm-section-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 10px;
  }

  .pos-confirm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px 14px;
  }

  .pos-confirm-field span {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 2px;
  }

  .pos-confirm-field strong {
    font-size: 14px;
    color: var(--text-dark);
  }

  .pos-confirm-table .modern-table th,
  .pos-confirm-table .modern-table td {
    font-size: 13px;
    padding: 8px 12px;
  }

  .pos-confirm-table {
    overflow-x: auto;
  }

  .pos-confirm-totals {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
  }

  .pos-confirm-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: #f8fafc;
  }

  .pos-confirm-total.highlight {
    background: #e8f0ff;
    border-color: #b9c8ea;
  }

  .pos-confirm-total span {
    font-size: 12px;
    color: var(--text-muted);
  }

  .pos-confirm-total strong {
    font-size: 14px;
    color: var(--text-dark);
  }

  .pos-invoice-modal .modal-header {
    background: #f8fafc;
  }

  .pos-invoice-body {
    padding: 20px;
    background: #f5f7fb;
  }

  .pos-invoice-summary {
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 16px;
  }

  .pos-invoice-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e8f5e9;
    color: #2e7d32;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    margin-bottom: 12px;
  }

  .pos-invoice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
  }

  .pos-invoice-grid span {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 2px;
  }

  .pos-invoice-grid strong {
    font-size: 14px;
    color: var(--text-dark);
  }

  .pos-invoice-totals {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    border-top: 1px dashed var(--border-light);
    padding-top: 10px;
  }

  .pos-invoice-totals span {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 2px;
  }

  .pos-invoice-totals strong {
    font-size: 15px;
    color: var(--text-dark);
  }

  .product-selection-container {
    padding: 15px 20px 20px 20px;
    border-bottom: 1px solid var(--border-light);
  }

  .qty-stepper {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .qty-stepper input {
    flex: 1;
    text-align: center;
  }

  .btn-qty {
    width: 55px;
    height: 40px;
    border-radius: 6px;
    border: 1px solid #636363;
    background: #f8f9fa;
    color: var(--text-dark);
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s, border-color 0.2s;
    font-size: 22px;
  }

  .btn-qty:hover,
  .btn-qty:focus {
    background: #eef2f7;
    border-color: #cbd5e1;
    outline: none;
  }

  .products-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 0px;
    min-height: auto;
  }

.production-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--border-light);
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.production-footer.pos-footer-inline {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
}

.production-footer.pos-footer-inline .keyboard-help {
  flex-basis: 100%;
}

  .btn-search-icon,
  .btn-add-icon {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    outline: none;
  }

  .btn-search-icon:hover,
  .btn-search-icon:focus,
  .btn-add-icon:hover,
  .btn-add-icon:focus {
    background: #0052cc;
    transform: translateY(-1px);
  }

  .autocomplete-container {
    display: flex;
    gap: 8px;
    align-items: center;
  }

  .autocomplete-container .search-bar {
    flex: 1;
  }

  #btnToggleProductSearchFilters {
    flex: 0;
    margin-left : 6px;
    font-weight: bolder;
    border: 1px solid #808080;
    display: none;
  }

  .inline-qty-input {
      width: 90px;
      padding: 6px 8px;
      border: 1px solid #a4a4a4;
      border-radius: 0;
      font-size: 17px;
      background: #ffffff;
      color: #393939;
      text-align: center;
      font-weight: bolder;
  }
  
  .variant-tab-content .input-group {   
    margin-right: 10px;
    float: left;
  }
  /* Responsive Production Layout */
  @media (max-width: 1024px) {
    .production-container {
      flex-direction: column;
      height: auto;
      overflow: visible;
    }

    .production-container.pos-wrap {
      height: auto;
    }

    .production-container.pos-wrap .pos-main {
      flex-direction: column;
    }

    .production-left,
    .production-right {
      flex: 1;
       overflow: visible;
    }
    .content {
      padding:  10px !important;
    }
    .reports-container {
      width: 100%;
      padding: 0 !important;
    }
  }

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

    .pos-inline-fields {
      flex-wrap: wrap;
    }
  }

.modal-footer-help {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 12px;
  }
  
  .category-name-cell {
    font-weight: 600;
    color: var(--primary-blue);
  }
  .btn-filter { background: #f0f3f7; color: var(--text-dark); border: 1px solid var(--border-light); padding: 8px 16px; border-radius: var(--radius); font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: 0.2s; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
  .btn-filter:hover, .btn-filter:focus { background: #e0e6ed; border-color: var(--primary-blue); color: var(--primary-blue); }
  .desktop-only { display: block; }
  .desktop-table-view { display: block; }
  .mobile-list-view { display: none; }
  
  /* Mobile List View Styles */
  .mobile-list-view { padding: 10px; }
  .mobile-list-item { background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius); margin-bottom: 12px; padding: 16px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); transition: 0.2s; cursor: pointer; outline: none; }
  .mobile-list-item:hover, .mobile-list-item:focus { box-shadow: 0 4px 8px rgba(0,0,0,0.1); border-color: var(--primary-blue); }
  .mobile-list-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border-light); }
  .mobile-list-title { font-size: 16px; font-weight: 600; color: var(--primary-blue); flex: 1; }
  .mobile-list-actions { display: flex; gap: 6px; align-items: center; }
  .mobile-list-actions button { 
    background: none; 
    border: 1px solid var(--border-light); 
    padding: 8px; 
    cursor: pointer; 
    border-radius: 6px; 
    transition: all 0.2s; 
    touch-action: manipulation; 
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    color: var(--text-muted);
  }
  .mobile-list-actions button svg {
    display: block;
    width: 18px;
    height: 18px;
  }
  .mobile-list-actions .btn-view {
    color: #2196F3;
    border-color: #e3f2fd;
  }
  .mobile-list-actions .btn-view:hover,
  .mobile-list-actions .btn-view:focus {
    background: #e3f2fd;
    border-color: #2196F3;
    color: #1976D2;
    transform: translateY(-1px);
  }
  .mobile-list-actions .btn-edit {
    color: #FF9800;
    border-color: #fff3e0;
  }
  .mobile-list-actions .btn-edit:hover,
  .mobile-list-actions .btn-edit:focus {
    background: #fff3e0;
    border-color: #FF9800;
    color: #F57C00;
    transform: translateY(-1px);
  }
  .mobile-list-actions .btn-delete {
    color: #f44336;
    border-color: #ffebee;
  }
  .mobile-list-actions .btn-delete:hover,
  .mobile-list-actions .btn-delete:focus {
    background: #ffebee;
    border-color: #f44336;
    color: #d32f2f;
    transform: translateY(-1px);
  }
  .mobile-list-body { display: flex; flex-direction: column; gap: 10px; }
  .mobile-list-field { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
  .mobile-list-label { font-size: 14px; font-weight: 600; color: var(--text-muted); min-width: 80px; }
  .mobile-list-value { font-size: 14px; color: var(--text-dark); text-align: right; flex: 1; word-break: break-word; }
  
  .data-card { background: #fff; border-radius: var(--radius); border: 1px solid var(--border-light); box-shadow: var(--card-shadow);   }
  .modern-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 16px; }
  .modern-table th { background: #f8fafc; padding: 12px 20px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; font-size: 14px; letter-spacing: 0.5px; border-bottom: 1px solid var(--border-light); cursor: pointer; }
  .modern-table td { font-weight: bold; padding: 4px 20px; border-bottom: 1px solid #dcdcdc; color: var(--text-dark); }
  .modern-table tr:last-child td { border-bottom: none; }
  .modern-table tr:hover { background: #fcfdfe; }
  
  /* Responsive table wrapper */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }
  .status-pill { padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
  .pill-success { background: #e6f9ed; color: #27ae60; }
  
  .modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(26, 33, 45, 0.6);
    display: none;
    justify-content: center; /* center horizontally */
    align-items: flex-start; /* align to top */
    padding-top: 40px;       /* spacing from top */
    z-index: 5;
  }
  .search-bar {
    background: #f0f3f7;
    font-weight: bold;
    border: 1px solid #3c3c37;
    padding: 10px 15px;
    border-radius: var(--radius);
    width: 400px;
    outline: none;
    transition: 0.2s;
  }
  .modal-content {
    width: 90%;              /* almost full width */
    max-width: 1200px;
    background: #fff;
    border-radius: 0px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    animation: slideDown 0.3s ease-out;
    max-height: 90vh;
    overflow: hidden;
  }

  /* Advanced Product Search modal - base + responsive */
  .product-search-modal-overlay {
    align-items: flex-start;
    padding: 16px;
    overflow-y: auto;
  }
  .product-search-modal-content {
    width: 100%;
    max-width: 1100px;
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .btn-toggle-filters {
    display: inline-flex;
    align-self: flex-start;
    margin: 12px 20px 0;
    gap: 6px;
    align-items: center;
  }
  .product-search-modal-content.filters-collapsed .product-search-filters {
    display: none;
  }
  .product-search-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 8px 20px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
  }
  .product-search-filters .search-bar,
  .product-search-filters .search-select {
    min-width: 120px;
    flex: 1 1 140px;
    font-weight: bold;
    border: 1px solid #3c3c37;
  }
  .product-search-filters .btn-add {
    flex-shrink: 0;
  }
  .product-search-table-wrap {
    overflow-x: auto;
    overflow-y: auto;
    flex: 1;
    min-height: 200px;
    -webkit-overflow-scrolling: touch;
  }
  .product-search-table-wrap .modern-table {
    min-width: 500px;
  }
  .product-search-modal-content .pagination-wrapper {
    flex-shrink: 0;
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .filter-row  .input-group  {
    flex-direction: unset;
  }
  @media (max-width: 768px) {
    .direct-header-links-wrap {
      display: none;
    }
    .product-search-modal-overlay {
      padding: 8px;
      align-items: stretch;
    }
    .filter-row  .input-group  {
      flex-direction: column;
    }
    #btnToggleProductSearchFilters {
      display: flex;
    }
    .product-search-modal-content {
      max-height: calc(100vh - 16px);
    }
    .btn-toggle-filters {
      display: inline-flex;
    }
    .product-search-filters {
      flex-direction: column;
      align-items: stretch;
      padding: 12px;
    }
    .product-search-filters .search-bar,
    .product-search-filters .search-select {
      min-width: 0;
      flex: 1 1 auto;
      width: 100%;
    }
    .product-search-table-wrap {
      min-height: 180px;
    }
    .product-search-modal-content .modal-header {
      padding: 12px 16px;
    }
    .product-search-modal-content .modal-header h2 {
      font-size: 1.1rem;
    }
    .production-footer {
      position: fixed;
      flex-direction:row;
      bottom: 0;
    }
    .keyboard-help { display: none;}
    .app-header {
      position: relative;
    }
  }
  @media (max-width: 480px) {
    .product-search-filters {
      gap: 8px;
    }
    .product-search-table-wrap .modern-table {
      font-size: 13px;
    }
    .product-search-table-wrap .modern-table th,
    .product-search-table-wrap .modern-table td {
      padding: 8px 6px;
    }
  }

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

  .actions {
    display: flex;
    gap: 6px;
    align-items: center;
  }
  
  .actions button {
    background: none;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    cursor: pointer;
    padding: 6px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    outline: none;
    color: var(--text-muted);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  
  .actions button svg {
    display: block;
    width: 16px;
    height: 16px;
  }
  
  .actions .btn-view {
    color: #2196F3;
    border-color: #e3f2fd;
  }
  
  .actions .btn-view:hover,
  .actions .btn-view:focus {
    background: #e3f2fd;
    border-color: #2196F3;
    color: #1976D2;
    transform: translateY(-1px);
  }
  
  .actions .btn-edit {
    color: #FF9800;
    border-color: #fff3e0;
  }
  
  .actions .btn-edit:hover,
  .actions .btn-edit:focus {
    background: #fff3e0;
    border-color: #FF9800;
    color: #F57C00;
    transform: translateY(-1px);
  }
  
  .actions .btn-delete {
    color: #f44336;
    border-color: #ffebee;
  }
  
  .actions .btn-delete:hover,
  .actions .btn-delete:focus {
    background: #ffebee;
    border-color: #f44336;
    color: #d32f2f;
    transform: translateY(-1px);
  }

  
  /*
  .modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(26, 33, 45, 0.6); display: none; justify-content: flex-end; z-index: 1000; }
  .modal-content { width: 80%; max-width: 1100px; background: #fff; height: 100%; animation: slideInRight 0.3s ease-out; display: flex; flex-direction: column; }
  @keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
  */
  .modal-header { padding: 15px 20px; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; }
  .modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 4px;
  }
  .modal-close:hover, .modal-close:focus {
    background: #f0f3f7;
    color: var(--text-dark);
  }
  .modal-close svg {
    width: 20px;
    height: 20px;
    display: block;
  }
  .form-body { flex: 1; padding: 20px; overflow-y: auto; overflow-x: hidden; display: grid; grid-template-columns: repeat(4, 1fr); gap: 30px; -webkit-overflow-scrolling: touch; }
  .input-group { display: flex; flex-direction: column; gap: 8px; }
  .input-group label { font-size: 14px; font-weight: 600; color: var(--text-dark); }
  .input-group input, .input-group select, .input-group textarea {  max-width: 400px;    font-family: monospace; padding: 8px; border: 1px solid #282424; border-radius: 0px; font-size: 14px; font-weight: bold; outline: none; width: 100%; box-sizing: border-box; }
  .input-group input:focus { border-color: var(--primary-blue); box-shadow: 0 0 0 3px rgba(0,103,255,0.1); }
  .checkbox-list { display: flex; flex-direction: row; gap: 6px; max-height: 180px; overflow-y: auto; padding: 10px; border: 1px solid #282424; border-radius: 6px; background: #fff; }
  .checkbox-list label { display: inline; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text-dark); }
  .checkbox-list input[type="checkbox"] { width: 16px; height: 16px; margin: 0; }
  .pos-doc-accounts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
  .pos-doc-accounts .account-chip { background: #141414; color: #fff; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
  .pos-doc-accounts .account-chip.muted { background: #f0f3f7; color: #555; }
  #variantForm {
    gap: 30px;
    display: grid;
    grid-template-columns: 1fr;  /* repeat(3, 1fr); */
  }
  /* Prevent zoom on input focus on iOS */
  @supports (-webkit-touch-callout: none) {
    .input-group input[type="text"],
    .input-group input[type="email"],
    .input-group input[type="number"],
    .input-group input[type="tel"],
    .input-group input[type="search"],
    .input-group select,
    .input-group textarea {
      font-size: 16px; /* Prevents zoom on iOS */
    }
  }
  .modal-footer { padding: 20px 40px; border-top: 1px solid var(--border-light); background: #f8fafc; display: flex; gap: 15px; }
  .btn-save { 
    background: var(--primary-blue); 
    color: #fff; 
    border: none; 
    padding: 12px 50px; 
    border-radius: 6px; 
    font-weight: 600; 
    cursor: pointer; 
    touch-action: manipulation; 
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    outline: none;
  }
  .btn-save:hover, .btn-save:focus {
    background: #0052cc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,103,255,0.3);
  }
  .btn-save svg {
    width: 16px;
    height: 16px;
    display: block;
  }
  .btn-cancel { 
    background: #fff; 
    border: 1px solid #d0d7de; 
    padding: 12px 50px; 
    border-radius: 6px; 
    cursor: pointer; 
    touch-action: manipulation; 
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    outline: none;
    color: var(--text-dark);
  }
  .btn-cancel:hover, .btn-cancel:focus {
    background: #f6f8fa;
    border-color: #8c959f;
    transform: translateY(-1px);
  }
  .btn-cancel svg {
    width: 16px;
    height: 16px;
    display: block;
  }
  
  /* ========================================
     RESPONSIVE DESIGN - Mobile First Approach
     ======================================== */
  
  /* Tablet and below (1024px) */
  @media (max-width: 1024px) {
    .modal-content { 
      width: 95%; 
      max-width: 95vw; 
    }
    .form-body { 
      grid-template-columns: repeat(3, 1fr); 
      gap: 20px;
      padding: 30px;
    }
    .modal-header {
      padding: 15px 20px;
    }
    .modal-footer {
      padding: 15px 30px;
    }
    .content-area {
      padding: 20px;
    }
    .header-center {
      padding: 0 10px;
    }
  }
  
  /* Mobile landscape and below (768px) */
  @media (max-width: 768px) {
    /* Header adjustments */
    .header {
      height: auto;
      min-height: 60px;
      flex-wrap: wrap;
      padding: 10px 15px;
    }
    .header-left {
      gap: 10px;
      flex: 1;
      min-width: 0;
    }
    .header-center {
      order: 3;
      width: 100%;
      padding: 10px 0 0 0; 
      position: relative;
      overflow: visible;
    }
    .header-right {
      gap: 10px;
    }
    .logo {
      font-size: 18px;
    }
    
    /* Primary sidebar - show as bottom nav on mobile */
    .sidebar-primary {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      width: 100%;
      height: 60px;
      flex-direction: row;
      justify-content: space-around;
      padding: 8px 10px;
      gap: 8px;
      z-index: 100;
      box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
      overflow-x: auto;
      overflow-y: hidden;
      -webkit-overflow-scrolling: touch;
    }
    .nav-icon {
      width: 44px;
      height: 44px;
      font-size: 16px;
      flex: 0 0 auto;
    }
    
    /* Content area - add bottom padding for mobile nav */
    .content-area {
      padding: 15px;
      padding-bottom: 80px; /* Space for bottom nav */
    }
    
    /* Header menu - hamburger dropdown */
    .header-menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .header-menu {
      display: none;
      position: absolute;
      top: 100%;
      left: 0;
      right: 0;
      background: #fff;
      border: 1px solid var(--border-light);
      box-shadow: 0 4px 12px rgba(0,0,0,0.1);
      flex-direction: column;
      gap: 4px;
      padding: 8px 10px;
      margin-top: 6px;
      z-index: 200;
    }
    .header-menu.open { display: flex; }
    .header-menu-item {
      width: 100%;
      justify-content: flex-start;
      padding: 10px 12px;
      font-size: 13px;
    }
    .header-menu-item {
      flex-shrink: 0;
    }
    .header-menu-item .kb-badge {
      display: none; /* Hide badges on mobile to save space */
    }
    
    /* Modals */
    .modal-content {
      width: 100% !important;
      max-width: 100vw !important;
      max-height: 100vh !important;
      margin: 0 !important;
      border-radius: 0;
      padding-top: 0;
    }
    .modal-overlay {
      padding-top: 0;
      align-items: stretch;
    }
    .form-body {
      flex: none;
      grid-template-columns: 1fr !important;
      gap: 15px;
      padding: 20px 15px !important;
    }
    .form-body .input-group {
      grid-column: 1 !important;
      width: 100% !important;
      max-width: 100% !important;
    }
    .form-body .input-group[style*="grid-column"] {
      grid-column: 1 !important;
    }
    .form-body .input-group input,
    .form-body .input-group select,
    .form-body .input-group textarea {
      width: 100% !important;
      max-width: 100% !important;
      box-sizing: border-box;
    }
    .modal-header {
      padding: 15px 20px;
      position: sticky;
      top: 0;
      background: #fff;
      z-index: 10;
    }
    .modal-footer {
      padding: 15px 20px;
      position: sticky;
      bottom: 0;
      background: #f8fafc;
      z-index: 10;
      flex-wrap: wrap;
    }
    .btn-save, .btn-cancel {
      flex: 1;
      min-width: 120px;
    }
    
    /* Tables - make scrollable */
    .table-wrapper {
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      margin: 0 -15px;
      padding: 0 15px;
      /* Hide scrollbar but keep functionality */
      scrollbar-width: thin;
    }
    .table-wrapper::-webkit-scrollbar {
      height: 6px;
    }
    .table-wrapper::-webkit-scrollbar-thumb {
      background: #ccc;
      border-radius: 3px;
    }
    .modern-table {
      min-width: auto; /* Ensure table doesn't get too compressed */
    }
    .modern-table th,
    .modern-table td {
      padding: 10px 12px;
      font-size: 16px;
    }
    
    /* Search popup */
    .search-popup-overlay {
      padding-top: 20px;
      align-items: flex-start;
    }
    .search-popup-content {
      width: 95% !important;
      max-width: 95vw !important;
      margin: 20px auto;
      max-height: 85vh;
    }
    .search-popup-header {
      padding: 15px 20px;
    }
    .search-popup-body {
      padding: 15px 20px;
    }
    .search-popup-results {
      max-height: calc(85vh - 150px);
    }
    
    /* Page header */
    .page-header {
      flex-direction: column;
      align-items: flex-start;
      gap: 15px;
    } 
    /* Data card */
    .data-card {
      overflow-x: auto;
    }
    
    /* Show mobile list, hide desktop table on mobile */
    .desktop-table-view {
      display: none !important;
    }
    .mobile-list-view {
      display: block !important;
    }
    .desktop-only {
      display: none !important;
    }
    
    /* Pagination wrapper - use grid on mobile */
    .data-card > div:last-of-type {
      display: grid !important;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      padding: 10px 15px !important;
    }
    .data-card > div:last-of-type #pageInfo {
      grid-column: 1 / -1;
      text-align: center;
      margin: 5px 0;
    }
    .data-card > div:last-of-type #perPage {
      grid-column: 1 / -1;
      width: 100% !important;
      margin-left: 0 !important;
    }

    .production-right .form-body {
        padding-bottom: 100px !important;
    }

  }
  
  /* Small mobile (480px and below) */
  @media (max-width: 480px) {
    .header {
      padding: 8px 10px;
    }
    .logo {
      font-size: 16px;
    }
    .header-menu-item {
      padding: 10px 12px;
      font-size: 12px;
    }
    .content-area {
      padding: 10px;
      padding-bottom: 70px;
    }
    .nav-icon {
      width: 40px;
      height: 40px;
      font-size: 14px;
      min-width: 40px;
    }
    .sidebar-primary {
      height: 55px;
      padding: 6px 5px;
      gap: 5px;
    }
    .modal-header h2 {
      font-size: 18px;
    }
    .form-body {
      padding: 15px 10px !important;
      gap: 12px;
      grid-template-columns: 1fr !important;
    }
    .form-body .input-group {
      grid-column: 1 !important;
      width: 100% !important;
      max-width: 100% !important;
    }
    .form-body .input-group[style*="grid-column"] {
      grid-column: 1 !important;
    }
    .input-group input,
    .input-group select,
    .input-group textarea {
      padding: 10px;
      font-size: 16px; /* Prevent zoom on iOS */
      width: 100% !important;
      max-width: 100% !important;
      box-sizing: border-box;
    }
    .btn-save, .btn-cancel {
      padding: 10px 15px;
      font-size: 14px;
    }
    .page-header h1 {
      font-size: 20px;
    }
    .modern-table th,
    .modern-table td {
      padding: 8px 10px; 
    }
    
    /* Mobile list adjustments for small screens */
    .mobile-list-item {
      padding: 12px;
      margin-bottom: 10px;
    }
    .mobile-list-title {
      font-size: 15px;
    }
    .mobile-list-label {
      font-size: 12px;
      min-width: 70px;
    }
    .mobile-list-value {
      font-size: 13px;
    }
    .mobile-list-actions button {
      padding: 5px;
      font-size: 16px;
    }

   .production-left, .production-right {
        flex: none;
    }
    
    /* Pagination wrapper - ensure grid layout on small mobile */
    .data-card > div:last-of-type {
      padding: 10px 10px !important;
    }
  }
  
  /* Landscape orientation adjustments */
  @media (max-height: 600px) and (orientation: landscape) {
    .header {
      height: 50px;
      padding: 5px 15px;
    }
    .sidebar-primary {
      height: 50px;
    }
    .content-area {
      padding: 10px 15px;
    }
    .modal-content {
      max-height: 95vh;
    }
  }
  
  /* Print styles */
  @media print {
    .sidebar-primary,
    .sidebar-secondary,
    .header,
    .btn-add,
    .actions,
    .modal-overlay {
      display: none !important;
    }
    .content-area {
      padding: 0;
      width: 100%;
    }
  }

  /* Full-screen boot loader shown until app JS finishes permission/bootstrap checks */
  body:not(.app-ready) {
    --app-boot-progress: 12%;
    overflow: hidden !important;
  }
  /*body:not(.app-ready) #subscription-alert,
  body:not(.app-ready) #app-header,
  body:not(.app-ready) .app-main {
    visibility: hidden;
  }*/
  body:not(.app-ready)::before {
    content: "";
    position: fixed;
    inset: 0;
    background:var(--app-bg);
    opacity: 0.9;
    z-index: 3000;
  }
  body:not(.app-ready)::after {
    content: var(--app-boot-label, "Preparing workspace...");
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(430px, calc(100vw - 34px));
    padding: 26px 22px 52px;
    border-radius: 0;
    border: 1px solid #131313;
    color: #12335f;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.2px;
    line-height: 1.4;
    text-align: left;
    white-space: pre-line;
    box-shadow: 0 18px 42px rgba(9, 19, 34, 0.35);
    background:
      linear-gradient(135deg, #ffffff 0%, #eef4ff 100%) no-repeat,
      linear-gradient(90deg, #0b5dff var(--app-boot-progress), #d5e4ff var(--app-boot-progress)) no-repeat,
      repeating-linear-gradient(120deg, rgba(255, 255, 255, 0) 0 8px, rgba(255, 255, 255, 0.34) 8px 14px) no-repeat;
    background-size: 100% 100%, calc(100% - 44px) 10px, calc(100% - 44px) 10px;
    background-position: 0 0, 22px calc(100% - 20px), 22px calc(100% - 20px);
    z-index: 3001;
    animation: appBootPulse 1.7s ease-in-out infinite, appBootStripeShift 1s linear infinite;
  }
  @keyframes appBootPulse {
    0%, 100% { box-shadow: 0 18px 42px rgba(9, 19, 34, 0.35); }
    50% { box-shadow: 0 22px 50px rgba(9, 19, 34, 0.45); }
  }
  @keyframes appBootStripeShift {
    0% { background-position: 0 0, 22px calc(100% - 20px), 22px calc(100% - 20px); }
    100% { background-position: 0 0, 22px calc(100% - 20px), 46px calc(100% - 20px); }
  }

  /* App header (web menu) – visible only when logged in via JS */
  .app-header { background: #fff; border-bottom: 1px solid var(--border-light); box-shadow: 0 1px 3px rgba(0,0,0,0.06);   top: 0; z-index: 100; transition: opacity 0.2s, visibility 0.2s; }
  .app-header.hidden { opacity: 0; visibility: hidden; pointer-events: none; height: 0; overflow: hidden; border: none; }
  .subscription-alert {
    background: #b91c1c;
    color: #fff;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #7f1d1d;
  }
  .subscription-alert a {
    color: #fff;
    text-decoration: underline;
    font-weight: 700;
    white-space: nowrap;
  }
  .subscription-alert a:hover,
  .subscription-alert a:focus {
    color: #fff;
    opacity: 0.92;
  }
  .app-header-inner { display: flex; align-items: center; justify-content: space-between; padding: 0 20px; min-height: 56px; max-width: 100%; }
  .app-header-logo { font-size: 20px; font-weight: 800; color: var(--primary-blue); letter-spacing: -0.5px; text-decoration: none; padding: 8px 0; }
  .app-header-logo:hover, .app-header-logo:focus { color: #0052cc; outline: none; }
  .app-header-nav { display: flex; align-items: center; }
  .app-header-menu { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
  .app-header-menu li { margin: 0 3px; }
  .app-header-menu a { background:#f0f3f7; display: flex; align-items: center; gap: 4px; padding: 10px 8px; color: var(--text-dark); text-decoration: none; font-size: 16px; font-weight: bold; border-radius: var(--radius); transition: background 0.2s, color 0.2s; white-space: nowrap; }
  .app-header-menu a:hover, .app-header-menu a:focus { background: #f0f3f7; color: var(--primary-blue); outline: none; }
  .app-header-menu a kbd { font-size: 10px; padding: 2px 4px; background: rgba(0,0,0,0.06); border-radius: 4px; color: var(--text-muted); font-family: inherit; }
  .app-header-menu a:hover kbd, .app-header-menu a:focus kbd { background: rgba(0,103,255,0.15); color: var(--primary-blue); }
  .app-header-hamburger { display: none; background: none; border: 1px solid var(--border-light); padding: 10px 12px; border-radius: var(--radius); cursor: pointer; color: var(--text-dark); flex-direction: column; gap: 5px; align-items: center; justify-content: center; transition: background 0.2s; }
  .app-header-hamburger:hover, .app-header-hamburger:focus { background: #f0f3f7; outline: none; }
  .app-header-hamburger .hamburger-bar { display: block; width: 20px; height: 2px; background: currentColor; border-radius: 1px; transition: transform 0.2s; }
  .app-header-hamburger[aria-expanded="true"] .hamburger-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .app-header-hamburger[aria-expanded="true"] .hamburger-bar:nth-child(2) { opacity: 0; }
  .app-header-hamburger[aria-expanded="true"] .hamburger-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .app-main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
  .quicklinks-overlay { position: fixed; inset: 0; display: none; align-items: stretch; justify-content: flex-end; background: rgba(22, 28, 34, 0.32); z-index: 1400; }
  .quicklinks-overlay.open { display: flex; }
  .quicklinks-panel { width: 300px; max-width: 90vw; background: #fff; box-shadow: -4px 0 16px rgba(0,0,0,0.18); border-left: 1px solid var(--border-light); display: flex; flex-direction: column; transform: translateX(100%); transition: transform 0.25s ease-out; }
  .quicklinks-overlay.open .quicklinks-panel { transform: translateX(0); }
  .quicklinks-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border-light); }
  .quicklinks-panel-header h3 { margin: 0; font-size: 16px; font-weight: 700; }
  .quicklinks-close-btn { background: none; border: 1px solid var(--border-light); border-radius: var(--radius); width: 32px; height: 32px; font-size: 18px; cursor: pointer; color: var(--text-dark); display: flex; align-items: center; justify-content: center; transition: background 0.15s; }
  .quicklinks-close-btn:hover, .quicklinks-close-btn:focus { background: #f0f3f7; color: var(--primary-blue); outline: none; }
  .quicklinks-panel-body { padding: 10px 14px 16px; overflow-y: auto; flex: 1; }
  .quicklinks-panel-search { width: 100%; padding: 10px 12px; border: 1px solid var(--border-light); border-radius: var(--radius); margin-bottom: 10px; font-size: 14px; outline: none; }
  .quicklinks-panel-search:focus { border-color: var(--primary-blue); box-shadow: 0 0 0 3px rgba(0,103,255,0.12); }
  .quicklinks-panel-status { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
  .quicklinks-panel-list { display: flex; flex-direction: column; gap: 8px; outline: none; }
  .quicklinks-panel-item { border: 1px solid var(--border-light); border-radius: var(--radius); padding: 10px 12px; background: #f8fafc; text-align: left; width: 100%; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s, background 0.15s; }
  .quicklinks-panel-item:hover,
  .quicklinks-panel-item:focus-visible { border-color: var(--primary-blue); box-shadow: 0 0 0 3px rgba(0,103,255,0.12); outline: none; }
  .quicklinks-panel-item.selected { background: #eef4ff; border-width: 2px; border-color: #0b0d10; }
  .quicklinks-panel-title { display: block; font-weight: 700; margin-bottom: 4px; font-size: 14px; color: var(--text-dark); }
  .quicklinks-panel-meta { display: block; font-size: 12px; color: var(--text-muted); line-height: 1.4; }
  body.quicklinks-open { overflow: hidden; }

  /* Collapsible header nav up to 1400px (desktop hamburger) */
  @media (max-width: 2000px) {
    .app-header { position: relative; }
    .app-header-hamburger { display: flex; }
    .app-header-nav { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--border-light); box-shadow: 0 4px 12px rgba(0,0,0,0.1); max-height: 0; overflow: hidden; opacity: 0; transition: max-height 0.3s, opacity 0.2s; z-index: 150; display: none; }
    .app-header-nav.open { display: block; max-height: 80vh; overflow-y: auto; opacity: 1; }
    .app-header-menu { flex-direction: column; align-items: stretch; padding: 8px; gap: 0; width: 100%; }
    .app-header-menu a { padding: 14px 16px; border-radius: var(--radius); margin-bottom: 7px; }
  }

  @media (max-width: 768px) {
    body:not(.app-ready)::after {
      width: min(92vw, 380px);
      padding: 22px 18px 46px;
      font-size: 13px;
      background-size: 100% 100%, calc(100% - 36px) 9px, calc(100% - 36px) 9px;
      background-position: 0 0, 18px calc(100% - 16px), 18px calc(100% - 16px);
    }
    .app-header-hamburger { display: flex; }
    .app-header-nav { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--border-light); box-shadow: 0 4px 12px rgba(0,0,0,0.1); max-height: 0; overflow: hidden; opacity: 0; transition: max-height 0.3s, opacity 0.2s; }
    .app-header-nav.open { max-height: 80vh; overflow-y: auto; opacity: 1; }
    .app-header-menu { flex-direction: column; align-items: stretch; padding: 8px; gap: 0; width: 100%; }
    .app-header-menu a { padding: 14px 16px; border-radius: var(--radius); margin-bottom: 7px; }
    .subscription-alert { flex-direction: column; align-items: flex-start; }

    input, select, textarea {  border: 2px inset light-dark(rgb(52 138 52), rgb(107 172 121)) !important }
    .modern-table td {
        font-weight: bold;
        padding: 4px 20px;
        border-bottom: 1px solid #6f6f6f;
        color: #0b0d10;
    }
    .btn-add, .btn-delete, .btn-edit, .btn-view {
      padding: 14px 20px;
    }
    .hide-mobile {display: none;}
    .product-selection-container {
      padding: 10px 15px;
    }
  }

  /* Legacy layout compatibility */
  .layout { display:flex; min-height:100vh; }
  .sidebar { width: 240px; background: var(--sidebar-bg); color: #fff; padding: 16px; }
  .sidebar .logo { font-weight: 700; margin-bottom: 16px; }
  .sidebar a { color: #cbd5e1; text-decoration: none; display:block; padding: 8px; border-radius: 6px; }
  .sidebar a:focus, .sidebar a:hover { background: rgba(255,255,255,0.1); outline: none; }
  
  .content { flex:1; padding: 13px; }
  .content .header { display:flex; gap:8px; align-items:center; margin-bottom:16px; }
  .content .header input { flex:1; padding:8px 12px; border:1px solid var(--border-light); border-radius:8px; }
  .btn { padding:8px 12px; border:1px solid var(--border-light); background:#fff; border-radius:8px; cursor:pointer; box-shadow: 0 1px 2px var(--card-shadow); }
  .btn.primary { background: var(--primary-blue); color:#fff; border-color: var(--primary-blue); }
  
  .table-container { background:#fff; border:1px solid var(--border-light); border-radius:12px; box-shadow: var(--card-shadow); }
  .table { width:100%; border-collapse: collapse; }
  .table th, .table td { padding:10px; border-bottom:1px solid var(--border-light); }
  .table tr:focus { outline: 2px solid var(--primary-blue); }
  
  .badge { padding:4px 8px; border-radius:999px; font-size:14px;font-weight: bold; }
  .badge.active { background:#dcfce7; color:#166534; }
  .badge.inactive { background:#fee2e2; color:#991b1b; }
  
  .pager { display:flex; gap:8px; align-items:center; padding:12px; }
  
  .modal { position:fixed; inset:0; background: rgba(0,0,0,0.3); display:flex; align-items:center; justify-content:center; }
  .modal .modal-content { background:#fff; width: 520px; max-width: 90vw; border-radius:12px; padding:16px; box-shadow: 0 6px 20px var(--card-shadow); }
  .modal .modal-content form { display:grid; gap:8px; }
  .modal-actions { display:flex; gap:8px; justify-content:flex-end; }
  label { display:flex; flex-direction:column; gap:4px; }
  input, select { padding:8px; border:1px solid var(--border-light); border-radius:8px; }
  
  .production-right .form-body {
    flex: none;
    gap:0
  }
 .production-right .form-body .input-group {
    margin-bottom: 0;
    margin: 5px;
}
.production-left .input-group {
    margin-bottom: 0;
    margin: 0;
    display: inline-flex;
}
.production-left .input-group #productQty {
  width: 94px;
}
.production-left .input-group .btn-qty {
  width: 46px;
}
.production-left .input-group .btn-add {
  padding: 13px 20px;
}

.page-info strong#posProductTaxTotal,
.page-info strong#posSubtotal,
.page-info strong#posGlobalOtherChargeTotal,
.page-info strong#posGrossTaxableValue,
.page-info strong#posNetTaxableValue,
.page-info strong#posGrandTotal {
    background: #141414;
    padding: 6px;
    font-size: 20px;
    color: #ffffff;
}

.hider {
  display: none !important;
}

 @media print {
  .report-filters,
  .btn-add,
  .btn-cancel {
    display: none !important;
  }

  /* Optional: adjust table layout for printing */
  .report-table-wrap {
    overflow: visible !important;
  }
}

.autocomplete-item.highlight {
  background-color: var(--primary-light);
  color: var(--primary-dark);
  border: 1px solid var(--primary-blue);
}

#importExportPanel {
  padding: 15px;
}
.metric-list-items li {  
   border-bottom: 1px solid #dadada;
}
.widget-card .btn-view { 
  border-radius: 2px; 
  background: #5e7a9d; 
  box-shadow: none; 
  border: 0;
}
.widget-card .btn-view:hover, .widget-card .btn-view:focus {
  background: #5f6267; 
}
.filter-row   .input-group label {
  display: none;
}
.widget-select select#freqSoldDays,
.widget-select select#freqPurchasedDays {
  display: none;
}
/*POS Design override*/
.pos-wrap .btn-add, .pos-wrap .btn-delete, .pos-wrap .btn-edit, .pos-wrap .btn-view {
  background: #6e6e6e;
  color: #ffffff;
  box-shadow: none;
}
.pos-wrap .modern-table td {
    font-weight: bold;
}
.pos-wrap .btn-search-icon, 
.pos-wrap .btn-add-icon {
    background: #6e6e6e;
    color: white;
    border: none;
    padding: 7px 12px;
}

/* Order Management */
.order-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.order-summary-grid.order-summary-grid-wide {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.order-summary-card {
  background: #f8f9fb;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.order-summary-card .label {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.order-summary-card .value {
  font-weight: 700;
  color: var(--text-dark);
}
.order-summary-card .meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.order-summary-kv {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-top: 6px;
  border-top: 1px dashed #d7dce2;
  padding-top: 6px;
}
.order-summary-kv span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}
.order-summary-kv strong {
  text-align: right;
  color: var(--text-dark);
  font-size: 13px;
}
.order-detail-section {
  margin-top: 18px;
}
.order-detail-section h3 {
  margin: 0 0 8px 0;
}
.order-detail-table-wrap {
  overflow: auto;
}
.order-detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 6px 0 12px 0;
}
.order-detail-actions .btn-add,
.order-detail-actions .btn-cancel {
  padding: 8px 14px;
}
.order-detail-modal .modal-content {
  max-width: 1100px;
}
.order-detail-modal-content {
  width: 95vw;
  max-height: 90vh;
  overflow: auto;
  padding: 0 20px;
}
.order-detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid #e1e1e1;
  margin: 8px 0 12px;
}
.order-tab-btn {
  padding: 10px 16px;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  transition: all 0.2s;
}
.order-tab-btn:hover {
  color: var(--primary-blue);
  background: var(--bg-light);
}
.order-tab-btn:focus {
  outline: 2px solid var(--primary-blue);
  outline-offset: -2px;
}
.order-tab-btn.active {
  color: var(--primary-blue);
  border-bottom-color: var(--primary-blue);
  font-weight: 600;
}
.order-tab-content {
  display: none;
}
.order-tab-content.active {
  display: block;
}
.order-edit-panel {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 8px 0 12px;
}
.order-edit-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.order-edit-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
  flex: 1;
}
.order-edit-field label {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-muted);
}
.order-edit-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.order-table-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}
.order-table-search {
  width: 260px;
  max-width: 100%;
}
.order-table-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
}
.order-table-pagination span {
  font-size: 12px;
  color: var(--text-muted);
}
.order-receipt-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.order-receipt-cell .btn-receipt-download {
  align-self: flex-start;
  padding: 6px 10px;
  font-size: 12px;
}
.order-line-breakup {
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
}
.order-line-breakup strong {
  color: #475569;
}
.order-image-modal-content {
  max-width: 900px;
  width: 90vw;
}
.order-image-modal {
  z-index: 1200;
}
.order-image-body {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.order-image-body img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border: 1px solid #d6d6d6;
  border-radius: 6px;
  background: #fff;
}
.status-pill.status-paid {
  background: #e6f9ed;
  color: #1f8f4d;
}
.status-pill.status-partial {
  background: #fff3e0;
  color: #b26a00;
}
.status-pill.status-pending {
  background: #ffebee;
  color: #ba1a1a;
}
.status-pill.status-neutral {
  background: #eef2f7;
  color: #5b6777;
}

/* My Orders */
.my-orders-settings {
  padding: 14px 18px;
}
.my-orders-settings-grid {
  display: flex;
  gap: 12px 18px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.my-orders-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-dark);
}
.my-orders-settings-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.my-orders-list-card .my-orders-filters {
  flex-wrap: wrap;
}
.my-orders-list-card .my-orders-filters .search-bar,
.my-orders-list-card .my-orders-filters .search-select {
  width: 220px;
  max-width: 100%;
}
.my-orders-table-wrap {
  overflow: auto;
}
.my-orders-row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-my-order-view,
.btn-my-order-pdf {
  padding: 6px 10px;
  font-size: 12px;
}
.my-orders-detail-content {
  width: 95vw;
  max-height: 90vh;
  overflow: auto;
  padding: 0 20px;
}
.my-orders-edit-panel {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 10px 0 14px;
}
.my-orders-edit-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.my-orders-edit-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.my-orders-edit-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}
.my-orders-edit-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.my-orders-edit-panel textarea.search-bar {
  width: 100%;
}
body.my-orders-hide-total .my-orders-col-total {
  display: none;
}
body.my-orders-hide-total .my-orders-col-item-total {
  display: none;
}
body.my-orders-hide-item-price .my-orders-col-item-price {
  display: none;
}
body.my-orders-hide-pdf #btnMyOrderDownloadPdf,
body.my-orders-hide-pdf .btn-my-order-pdf {
  display: none !important;
}
@media (max-width: 768px) {
  .my-orders-list-card .my-orders-filters .search-bar,
  .my-orders-list-card .my-orders-filters .search-select {
    width: 100%;
  }
  .my-orders-settings {
    padding: 12px;
  }
  .my-orders-detail-content {
    width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    padding: 0 10px 14px;
  }
}

.pos-wrap .modern-table th {
    background: #141414;
    padding: 12px 10px;
    color: #cdca0e;
    font-weight: 600;
}
.pos-wrap input, .pos-wrap select, .pos-wrap textarea {
  font-size: 15px;
}
#globalTaxSearchInput { margin: 5px 0;}
.inline-qty-input { padding: 4px 8px; border: 2px inset #ffffff; font-size: 20px;   background: #161616;  color: #ddda10;}
.pos-wrap  select:focus, 
.pos-wrap  input:focus,
.pos-wrap  textarea:focus {
    border: 2px inset #4d4d4d;
}
/*
 .pos-wrap .btn-delete {
   padding: 8px 20px;
 } */
 .pos-wrap .modern-table td {
   padding:4px 10px
 }

 #appliedTaxesTable .modern-table td {
   padding:4px 5px;
 }
 #appliedTaxesTable  .modern-table th {
 padding:4px 5px;
}
