/* ============================================================
   Inventory ERP — global styles
   ============================================================ */

:root {
  --erp-primary: #2f6fed;
  --erp-primary-hover: #1d5ed9;
  --erp-primary-soft: #eef4ff;
  --erp-sidebar-bg: #0f172a;
  --erp-sidebar-bg-alt: #1e293b;
  --erp-sidebar-text: #cbd5e1;
  --erp-sidebar-muted: #64748b;
  --erp-sidebar-active: #2f6fed;
  --erp-body-bg: #f1f5f9;
  --erp-surface: #ffffff;
  --erp-border: #e2e8f0;
  --erp-text: #0f172a;
  --erp-text-muted: #64748b;
  --erp-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --erp-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  --erp-shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
  --erp-radius: 12px;
  --erp-radius-sm: 8px;
  --erp-sidebar-width: 260px;
  --erp-transition: 0.22s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--erp-body-bg);
  color: var(--erp-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.sidebar-open {
  overflow: hidden;
}

/* ---------- Layout ---------- */
.erp-sidebar {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: var(--erp-sidebar-width);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1040;
  overflow: hidden;
  background: linear-gradient(180deg, var(--erp-sidebar-bg) 0%, #111827 100%);
  color: var(--erp-sidebar-text);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  transition: transform var(--erp-transition);
}

.erp-sidebar .brand {
  flex-shrink: 0;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(6px);
}

.erp-sidebar .brand-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.erp-sidebar .brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  flex-shrink: 0;
  object-fit: contain;
}

.erp-sidebar .brand-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.erp-sidebar .brand-subtitle {
  font-size: 0.58rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
  letter-spacing: 0.02em;
}

.erp-sidebar-scroll-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.erp-sidebar-scroll {
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  padding: 0.35rem 0 1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--erp-primary) rgba(255, 255, 255, 0.08);
}

/* Visible custom scrollbar — WebKit */
.erp-sidebar-scroll::-webkit-scrollbar {
  width: 10px;
}

.erp-sidebar-scroll::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  margin: 6px 0;
}

.erp-sidebar-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #4f86f7 0%, var(--erp-primary) 100%);
  border-radius: 999px;
  border: 2px solid rgba(15, 23, 42, 0.5);
  min-height: 40px;
}

.erp-sidebar-scroll::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #6b9cff 0%, #3b7af5 100%);
}

.erp-sidebar-scroll.is-scrollable {
  padding-right: 2px;
}

.erp-sidebar-scroll-fade {
  position: absolute;
  left: 0;
  right: 0;
  height: 28px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 2;
}

.erp-sidebar-scroll-fade.visible {
  opacity: 1;
}

.erp-sidebar-scroll-fade-top {
  top: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.95) 0%, transparent 100%);
}

.erp-sidebar-scroll-fade-bottom {
  bottom: 0;
  background: linear-gradient(0deg, rgba(17, 24, 39, 0.95) 0%, transparent 100%);
}

.erp-sidebar .brand-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 1.05rem;
  line-height: 1.2;
}

.erp-sidebar-close {
  display: none;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.erp-sidebar-close:hover {
  background: rgba(255, 255, 255, 0.14);
}

.erp-sidebar .nav-link {
  color: var(--erp-sidebar-text);
  padding: 0.58rem 0.85rem;
  margin: 2px 10px;
  border-radius: var(--erp-radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background-color var(--erp-transition), color var(--erp-transition), transform 0.15s ease;
}

.erp-sidebar .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.erp-sidebar .nav-link.active {
  background: linear-gradient(90deg, var(--erp-sidebar-active), #4f86f7);
  color: #fff;
  box-shadow: 0 4px 12px rgba(47, 111, 237, 0.35);
}

.erp-sidebar .nav-section-title {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--erp-sidebar-muted);
  padding: 1rem 1.25rem 0.35rem;
}

.erp-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1035;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity var(--erp-transition);
}

.erp-sidebar-backdrop.show {
  display: block;
  opacity: 1;
}

.erp-content {
  margin-left: var(--erp-sidebar-width);
  min-height: 100vh;
  padding: 1.25rem 1.5rem 2rem;
  transition: margin-left var(--erp-transition);
}

.erp-topbar {
  margin-bottom: 1.25rem;
}

.erp-topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--erp-surface);
  border: 1px solid var(--erp-border);
  border-radius: var(--erp-radius);
  padding: 0.85rem 1rem;
  box-shadow: var(--erp-shadow-sm);
}

.erp-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.erp-topbar-left h5 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--erp-text);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.erp-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.erp-user-badge {
  font-size: 0.82rem;
  color: var(--erp-text-muted);
  background: var(--erp-body-bg);
  border: 1px solid var(--erp-border);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.erp-menu-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--erp-radius-sm);
  flex-shrink: 0;
}

.erp-menu-btn svg {
  width: 20px;
  height: 20px;
}

/* ---------- Cards & surfaces ---------- */
.stat-card {
  background: var(--erp-surface);
  border: 1px solid var(--erp-border);
  border-radius: var(--erp-radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--erp-shadow-sm);
  height: 100%;
  transition: box-shadow var(--erp-transition), transform var(--erp-transition);
}

.stat-card:hover {
  box-shadow: var(--erp-shadow);
}

.stat-card h6 {
  font-weight: 700;
  color: var(--erp-text);
}

.stat-card .stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--erp-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.stat-card .stat-value {
  font-size: clamp(1.15rem, 2.5vw, 1.55rem);
  font-weight: 700;
  color: var(--erp-text);
  line-height: 1.2;
}

/* ---------- Tabs ---------- */
.nav-tabs {
  border-bottom: 1px solid var(--erp-border);
  gap: 0.25rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-tabs .nav-link {
  border: none;
  border-radius: var(--erp-radius-sm) var(--erp-radius-sm) 0 0;
  color: var(--erp-text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.6rem 1rem;
  white-space: nowrap;
  transition: color var(--erp-transition), background-color var(--erp-transition);
}

.nav-tabs .nav-link:hover {
  color: var(--erp-primary);
  background: var(--erp-primary-soft);
}

.nav-tabs .nav-link.active {
  color: var(--erp-primary);
  background: var(--erp-surface);
  border: 1px solid var(--erp-border);
  border-bottom-color: var(--erp-surface);
  margin-bottom: -1px;
}

/* ---------- Tables ---------- */
.table-responsive {
  border-radius: var(--erp-radius-sm);
}

.table {
  margin-bottom: 0;
}

.table thead th {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--erp-text-muted);
  background: #f8fafc;
  border-bottom-width: 1px;
  white-space: nowrap;
}

.table-hover tbody tr:hover {
  background-color: #f8fafc;
}

.table td,
.table th {
  vertical-align: middle;
}

.table .btn-sm {
  white-space: nowrap;
}

/* ---------- Forms & buttons ---------- */
.form-control,
.form-select {
  border-color: var(--erp-border);
  border-radius: var(--erp-radius-sm);
  padding: 0.55rem 0.75rem;
  transition: border-color var(--erp-transition), box-shadow var(--erp-transition);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--erp-primary);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.15);
}

.form-label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--erp-text);
  margin-bottom: 0.35rem;
}

.btn {
  border-radius: var(--erp-radius-sm);
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow var(--erp-transition);
}

.btn-primary {
  background-color: var(--erp-primary);
  border-color: var(--erp-primary);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--erp-primary-hover);
  border-color: var(--erp-primary-hover);
}

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

/* ---------- Alerts & modals ---------- */
.alert {
  border: none;
  border-radius: var(--erp-radius-sm);
  box-shadow: var(--erp-shadow-sm);
}

.modal-content {
  border: 1px solid var(--erp-border);
  border-radius: var(--erp-radius);
  box-shadow: var(--erp-shadow-lg);
}

.modal-header {
  border-bottom: 1px solid var(--erp-border);
  padding: 1rem 1.25rem;
}

.modal-footer {
  border-top: 1px solid var(--erp-border);
  padding: 0.85rem 1.25rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.badge {
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ---------- Auth pages ---------- */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
}

.auth-card {
  background: var(--erp-surface);
  border-radius: var(--erp-radius);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  width: 100%;
  max-width: 440px;
  box-shadow: var(--erp-shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-card h4 {
  color: var(--erp-text);
}

/* Company Branding on Auth Card */
.auth-company-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-company-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--erp-primary-soft) 0%, #e0e7ff 100%);
  border-radius: 16px;
  color: var(--erp-primary);
  box-shadow: 0 4px 14px rgba(47, 111, 237, 0.18);
  overflow: hidden;
}

.auth-company-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.auth-company-logo svg {
  width: 34px;
  height: 34px;
}

.auth-company-name {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--erp-text);
  margin-bottom: 0.25rem;
  letter-spacing: -0.01em;
}

.auth-company-info {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--erp-border);
  font-size: 0.83rem;
  color: var(--erp-text-muted);
}

.auth-company-info-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
  line-height: 1.45;
}

.auth-company-info-item:last-child {
  margin-bottom: 0;
}

.auth-company-info-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--erp-primary);
}

.auth-company-info-item a {
  color: var(--erp-primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s ease;
}

.auth-company-info-item a:hover {
  text-decoration: underline;
  color: var(--erp-primary-hover);
}

/* ---------- Searchable combobox ---------- */
.search-select {
  position: relative;
  width: 100%;
}

.search-select-wrap {
  width: 100%;
  min-width: 0;
}

.search-select-input {
  width: 100%;
  min-width: 0;
}

.search-select-dropdown {
  position: fixed;
  z-index: 1065;
  max-height: 240px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--erp-surface);
  border: 1px solid var(--erp-border);
  border-radius: var(--erp-radius-sm);
  box-shadow: var(--erp-shadow-lg);
}

.search-select-option {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background-color 0.15s ease;
}

.search-select-option:last-child {
  border-bottom: none;
}

.search-select-option:hover,
.search-select-option.active {
  background: var(--erp-primary-soft);
}

.search-select-option-label {
  display: block;
  font-size: 0.9rem;
  color: var(--erp-text);
  font-weight: 500;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.search-select-option-sub {
  display: block;
  font-size: 0.75rem;
  color: var(--erp-text-muted);
  margin-top: 0.15rem;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.search-select-empty {
  padding: 0.75rem;
  font-size: 0.85rem;
  color: var(--erp-text-muted);
}

td .search-select-wrap,
.line-product-mount {
  min-width: 180px;
}

.table-responsive:has(.search-select-open) {
  overflow: visible;
}

.stat-card:has(.search-select-open) {
  overflow: visible;
}

@media (max-width: 767.98px) {
  td .search-select-wrap,
  .line-product-mount {
    min-width: 140px;
  }

  .search-select-dropdown {
    max-height: min(50vh, 280px);
  }

  .table-responsive {
    overflow-x: auto;
    overflow-y: visible;
  }
}

/* ---------- Utility ---------- */
.text-end .btn + .btn {
  margin-left: 0.25rem;
}

/* Action button groups on small screens */
@media (max-width: 575.98px) {
  .table td.text-end {
    white-space: normal;
  }

  .table td.text-end .btn {
    margin: 0.15rem 0.1rem;
  }
}

/* ---------- Responsive: tablet & mobile ---------- */
@media (max-width: 991.98px) {
  .erp-sidebar {
    transform: translateX(-100%);
    box-shadow: var(--erp-shadow-lg);
  }

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

  .erp-sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .erp-content {
    margin-left: 0;
    padding: 1rem;
  }

  .erp-topbar-inner {
    padding: 0.75rem;
  }

  .erp-user-badge {
    max-width: 140px;
  }

  .stat-card {
    padding: 1rem;
  }

  .modal-dialog {
    margin: 0.75rem;
  }
}

@media (max-width: 575.98px) {
  .erp-content {
    padding: 0.75rem;
  }

  .erp-topbar-left h5 {
    font-size: 1rem;
  }

  .erp-topbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .auth-card {
    padding: 1.25rem;
  }

  .nav-tabs .nav-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }

  .d-flex.gap-2.flex-wrap,
  .d-flex.justify-content-between.align-items-center.mb-3 {
    gap: 0.5rem !important;
  }

  input[type="search"].form-control-sm,
  input[type="search"].form-control {
    width: 100% !important;
    max-width: 100% !important;
  }

  .table-line-items {
    -webkit-overflow-scrolling: touch;
  }

  .table-line-items td {
    padding: 0.5rem 0.4rem;
  }

  .table-line-items .form-control-sm {
    padding: 0.4rem 0.5rem;
    font-size: 0.875rem;
  }

  .w-sm-auto {
    width: 100% !important;
  }
}

@media (min-width: 576px) {
  .w-sm-auto {
    width: auto !important;
  }
}


/* ---------- Barcode Label Printing ---------- */
.barcode-label-sheet {
  display: flex;
  flex-wrap: wrap;
  gap: 3mm;
  padding: 3mm;
}

.barcode-label {
  border: 1px solid #ddd;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2mm;
  overflow: hidden;
  background: #fff;
}

.bl-company {
  font-size: 7px;
  color: #666;
  text-align: center;
  line-height: 1.2;
}

.bl-name {
  font-size: 8px;
  font-weight: bold;
  text-align: center;
  line-height: 1.2;
  margin: 0.5mm 0;
}

.bl-barcode {
  max-width: 90%;
  max-height: 50%;
}

.bl-code {
  font-size: 6px;
  text-align: center;
  margin-top: 0.3mm;
  font-family: monospace;
}

.bl-sku {
  font-size: 6px;
  color: #666;
  text-align: center;
}

.bl-price {
  font-size: 7px;
  font-weight: bold;
  text-align: center;
}

.product-select-item {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.product-select-item:hover {
  background-color: #f8f9fa;
}

/* ============================================================
   POS & Sales Screen Responsive Layout
   ============================================================ */

.pos-sticky-summary {
  position: sticky;
  top: 80px;
  z-index: 10;
}

/* Quantity Steppers */
.qty-stepper {
  display: inline-flex;
  align-items: center;
  border-radius: var(--erp-radius-sm);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.qty-stepper .btn-qty-minus,
.qty-stepper .btn-qty-plus {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  border: 1px solid var(--erp-border);
  background-color: #f8fafc;
  color: var(--erp-text);
  transition: all 0.15s ease;
  user-select: none;
  cursor: pointer;
}

.qty-stepper .btn-qty-minus:hover,
.qty-stepper .btn-qty-plus:hover {
  background-color: var(--erp-primary-soft);
  color: var(--erp-primary);
  border-color: var(--erp-primary);
}

.qty-stepper .btn-qty-minus:active,
.qty-stepper .btn-qty-plus:active {
  background-color: var(--erp-primary);
  color: #ffffff;
}

.qty-stepper .line-qty {
  width: 52px;
  height: 36px;
  min-width: 44px;
  text-align: center;
  border-left: none;
  border-right: none;
  border-radius: 0 !important;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0 4px;
}

/* Mobile Quick Payment Presets */
.quick-pay-btn {
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
}

/* Mobile Sticky Bottom Checkout Bar */
.pos-mobile-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--erp-border);
  box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.12);
  padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 991.98px) {
  body.has-pos-mobile-bar {
    padding-bottom: 86px;
  }

  .pos-mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
}

/* Responsive Table / Card Transformation on Mobile (<768px) */
@media (max-width: 767.98px) {
  .table-pos-responsive thead {
    display: none;
  }

  .table-pos-responsive tbody,
  .table-pos-responsive tr.sale-line-item {
    display: block;
    width: 100%;
  }

  .table-pos-responsive tr.sale-line-item {
    background: #ffffff;
    border: 1px solid var(--erp-border);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
    position: relative;
  }

  .table-pos-responsive tr.sale-line-item > td {
    display: block;
    padding: 3px 0;
    border: none;
  }

  .table-pos-responsive .cell-product {
    margin-bottom: 6px;
  }

  .table-pos-responsive .cell-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--erp-text-muted);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px dashed var(--erp-border);
  }

  .table-pos-responsive .cell-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
  }

  .table-pos-responsive .cell-calc-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
  }

  .table-pos-responsive .cell-price-box {
    flex: 1 1 90px;
    max-width: 120px;
  }

  .table-pos-responsive .cell-discount {
    margin-top: 4px;
    margin-bottom: 4px;
    width: 100%;
  }

  .table-pos-responsive .cell-discount .line-discount-group {
    max-width: 100%;
    min-width: 0;
    width: 100%;
  }

  .table-pos-responsive .cell-total-box {
    text-align: right;
    font-size: 1.05rem;
    font-weight: 700;
  }

  .table-pos-responsive .btn-line-remove {
    width: 36px;
    height: 36px;
  }
}

/* ---------- Line Item Discount Inputs ---------- */
.line-discount-group {
  min-width: 105px;
  max-width: 145px;
  width: 100%;
}

.line-discount-val {
  min-width: 48px;
}

.line-discount-type {
  width: auto !important;
  min-width: 46px;
  max-width: 56px;
  padding-left: 5px;
  padding-right: 18px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}

/* ---------- Customer Accounting Statement & Ledger ---------- */
.statement-card {
  background: var(--erp-surface);
  border: 1px solid var(--erp-border);
  border-radius: var(--erp-radius);
  box-shadow: var(--erp-shadow-sm);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.statement-header-box {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #fff;
  border-radius: var(--erp-radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--erp-shadow);
}

.statement-header-box .doc-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
}

.statement-meta-item {
  font-size: 0.85rem;
  color: #cbd5e1;
  margin-bottom: 0.25rem;
}

.statement-meta-item strong {
  color: #fff;
}

.statement-meta-item .id-pill {
  background: rgba(255, 255, 255, 0.12);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-family: monospace;
  font-weight: 700;
  color: #fff;
}

.statement-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.statement-kpi-card {
  background: var(--erp-surface);
  border: 1px solid var(--erp-border);
  border-radius: var(--erp-radius-sm);
  padding: 0.85rem 1rem;
  box-shadow: var(--erp-shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.statement-kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--erp-shadow);
}

.statement-kpi-card .kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--erp-text-muted);
  margin-bottom: 0.25rem;
}

.statement-kpi-card .kpi-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--erp-text);
  line-height: 1.2;
}

.statement-kpi-card .kpi-sub {
  font-size: 0.75rem;
  color: var(--erp-text-muted);
  margin-top: 0.2rem;
}

.statement-kpi-card.kpi-debit {
  border-left: 3.5px solid #2f6fed;
}

.statement-kpi-card.kpi-credit {
  border-left: 3.5px solid #16a34a;
}

.statement-kpi-card.kpi-credit .kpi-value {
  color: #16a34a;
}

.statement-kpi-card.kpi-due {
  border-left: 3.5px solid #dc2626;
  background: #fffafa;
}

.statement-kpi-card.kpi-due .kpi-value {
  color: #dc2626;
}

.table-accounting {
  width: 100%;
  border-collapse: collapse;
}

.table-accounting thead th {
  background: #0f172a;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.65rem 0.85rem;
  border-bottom: none;
}

.table-accounting tbody td {
  padding: 0.65rem 0.85rem;
  font-size: 0.88rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.table-accounting tbody tr:nth-child(even) {
  background-color: #fafbfc;
}

.table-accounting tbody tr:hover {
  background-color: #f1f5f9;
}

.table-accounting tr.row-bf {
  background-color: #f8fafc;
  font-style: italic;
}

.table-accounting td.num,
.table-accounting th.num {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table-accounting .text-dr {
  color: #0f172a;
  font-weight: 600;
}

.table-accounting .text-cr {
  color: #16a34a;
  font-weight: 600;
}

.table-accounting .text-balance-dr {
  font-weight: 700;
  color: #0f172a;
}

.table-accounting .text-balance-cr {
  font-weight: 700;
  color: #16a34a;
}

.table-accounting tfoot tr {
  background-color: #f1f5f9;
  font-weight: 700;
  border-top: 2px solid #0f172a;
  border-bottom: 2px solid #0f172a;
}

.table-accounting tfoot td {
  padding: 0.75rem 0.85rem;
  font-size: 0.92rem;
}

.ref-badge {
  font-family: monospace;
  font-size: 0.8rem;
  background: #e2e8f0;
  color: #334155;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.particulars-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  margin-right: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.particulars-badge-invoice {
  background: #e0f2fe;
  color: #0369a1;
}

.particulars-badge-payment {
  background: #dcfce7;
  color: #15803d;
}

.particulars-badge-opening {
  background: #f3e8ff;
  color: #7e22ce;
}

.particulars-badge-return {
  background: #fef3c7;
  color: #b45309;
}

.particulars-badge-adjust {
  background: #f1f5f9;
  color: #475569;
}

.date-preset-btn {
  font-size: 0.75rem;
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
}

/* ---------- Print ---------- */
@media print {
  body * {
    visibility: hidden;
  }

  #invoicePrintArea,
  #invoicePrintArea *,
  #printableStatementArea,
  #printableStatementArea *,
  #printableReceiptArea,
  #printableReceiptArea * {
    visibility: visible;
  }

  #invoicePrintArea,
  #printableStatementArea,
  #printableReceiptArea {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }

  .erp-sidebar,
  .erp-sidebar-backdrop,
  .erp-topbar,
  .pos-mobile-bar,
  .nav-tabs,
  .no-print {
    display: none !important;
  }
}

