/* Gajaara POS Styles — Enhanced UI */

:root {
  --gajaara-green: #198754;
  --gajaara-dark: #0f5132;
  --gajaara-light: #d1e7dd;
  --color-sales: #198754;
  --color-invoices: #0d6efd;
  --color-discount: #e35d6a;
  --color-credit: #fd7e14;
  --color-outstanding: #dc3545;
  --color-customers: #6f42c1;
  --color-given: #20c997;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius: 10px;
  --radius-lg: 14px;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: #f0f2f5;
}

/* ─── Navbar ─── */
.navbar {
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  padding: 0.5rem 1rem;
}

.navbar-brand {
  font-size: 1.3em;
  letter-spacing: 1px;
}

.navbar .nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.navbar .nav-link-btn {
  color: rgba(255,255,255,0.75);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 0.82em;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.navbar .nav-link-btn:hover {
  color: white;
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.4);
}

.navbar .nav-link-btn.active {
  color: var(--gajaara-green);
  background: white;
  border-color: white;
  font-weight: 600;
}

/* ─── Stat Cards ─── */
.stat-card {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
  overflow: hidden;
  position: relative;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card .card-body {
  padding: 1.1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4em;
  flex-shrink: 0;
}

.stat-card .stat-info {
  flex: 1;
  min-width: 0;
}

.stat-card .stat-label {
  font-size: 0.78em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6c757d;
  margin-bottom: 2px;
}

.stat-card .stat-value {
  font-size: 1.5em;
  font-weight: 700;
  line-height: 1.1;
}

/* Stat card color variants */
.stat-card.stat-sales .stat-icon { background: #d1e7dd; color: var(--color-sales); }
.stat-card.stat-sales .stat-value { color: var(--color-sales); }

.stat-card.stat-invoices .stat-icon { background: #cfe2ff; color: var(--color-invoices); }
.stat-card.stat-invoices .stat-value { color: var(--color-invoices); }

.stat-card.stat-discount .stat-icon { background: #f8d7da; color: var(--color-discount); }
.stat-card.stat-discount .stat-value { color: var(--color-discount); }

.stat-card.stat-credit .stat-icon { background: #ffe5d0; color: var(--color-credit); }
.stat-card.stat-credit .stat-value { color: var(--color-credit); }

.stat-card.stat-outstanding .stat-icon { background: #f8d7da; color: var(--color-outstanding); }
.stat-card.stat-outstanding .stat-value { color: var(--color-outstanding); }

.stat-card.stat-customers .stat-icon { background: #e2d9f3; color: var(--color-customers); }
.stat-card.stat-customers .stat-value { color: var(--color-customers); }

.stat-card.stat-given .stat-icon { background: #d2f4ea; color: var(--color-given); }
.stat-card.stat-given .stat-value { color: var(--color-given); }

/* ─── Enhanced Cards ─── */
.card {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-header {
  border-radius: var(--radius) var(--radius) 0 0 !important;
  font-weight: 600;
}

.card-header.bg-success {
  background: linear-gradient(135deg, var(--gajaara-green), var(--gajaara-dark)) !important;
}

/* ─── Payment Breakdown ─── */
.payment-breakdown {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.payment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.82em;
  font-weight: 600;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
}

.payment-chip.cash { background: #d1e7dd; color: #0f5132; border-color: #badbcc; }
.payment-chip.upi { background: #cfe2ff; color: #084298; border-color: #b6d4fe; }
.payment-chip.card { background: #cff4fc; color: #055160; border-color: #b6effb; }
.payment-chip.credit { background: #fff3cd; color: #664d03; border-color: #ffecb5; }

/* ─── Search Results Dropdown ─── */
.search-results {
  position: absolute;
  z-index: 1050;
  width: calc(100% - 1rem);
  max-height: 400px;
  overflow-y: auto;
  background: white;
  border: 2px solid var(--gajaara-green);
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: var(--shadow-lg);
}

.search-result-item {
  padding: 10px 15px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s;
}

.search-result-item:hover,
.search-result-item.active {
  background-color: var(--gajaara-light);
}

.search-result-item .product-code {
  font-size: 1.1em;
  font-weight: bold;
  color: var(--gajaara-green);
  font-family: 'Courier New', monospace;
  min-width: 80px;
}

.search-result-item .short-code {
  background: var(--gajaara-green);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8em;
  font-weight: bold;
  margin: 0 10px;
}

.search-result-item .product-name {
  flex: 1;
  font-size: 0.95em;
}

.search-result-item .product-price {
  font-weight: bold;
  font-size: 1.1em;
  color: #333;
  min-width: 90px;
  text-align: right;
}

.search-result-item .stock-info {
  font-size: 0.75em;
  color: #666;
  margin-left: 10px;
}

.stock-low {
  color: #dc3545 !important;
  font-weight: bold;
}

/* ─── Bill Table ─── */
#billTable th {
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#billTable .qty-input {
  width: 70px;
  text-align: center;
  font-weight: bold;
}

#billTable .btn-remove {
  color: #dc3545;
  cursor: pointer;
  border: none;
  background: none;
  font-size: 1.2em;
}

#billTable .btn-remove:hover {
  color: #a71d2a;
}

/* ─── Held Bill Cards ─── */
.held-bill-card {
  border: 2px solid #ffc107;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fff9e6;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.held-bill-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.held-bill-card .customer-name {
  font-weight: bold;
  font-size: 1.1em;
}

.held-bill-card .bill-info {
  font-size: 0.85em;
  color: #666;
}

.held-bill-card .bill-time {
  font-size: 0.75em;
  color: #999;
}

/* ─── Sticky Billing Actions ─── */
.billing-actions-sticky {
  position: sticky;
  bottom: 0;
  background: #f0f2f5;
  padding: 12px 0;
  z-index: 10;
}

.billing-actions-sticky .btn-complete {
  font-size: 1.1em;
  padding: 12px;
  border-radius: 10px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  transition: transform 0.15s, box-shadow 0.15s;
}

.billing-actions-sticky .btn-complete:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.billing-actions-sticky .btn-hold {
  font-size: 1em;
  padding: 10px;
  border-radius: 10px;
  font-weight: 600;
}

/* ─── Admin Page ─── */
.admin-form .form-label {
  font-weight: 600;
  font-size: 0.9em;
}

/* ─── Dashboard Charts ─── */
.chart-container {
  position: relative;
  width: 100%;
  max-height: 280px;
}

.chart-container canvas {
  max-height: 280px;
}

/* ─── Section Headers ─── */
.section-header {
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 0.95em;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Filter Bar ─── */
.filter-bar {
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow-sm);
  padding: 10px 16px;
}

.filter-bar .btn-group-filter .btn {
  border-radius: 20px !important;
  padding: 4px 14px;
  font-size: 0.82em;
  font-weight: 500;
  margin: 0 2px;
}

/* ─── Toast notifications ─── */
.toast-container {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: 9999;
}

/* ─── Modal ─── */
.modal-header.bg-success {
  background: linear-gradient(135deg, var(--gajaara-green), var(--gajaara-dark)) !important;
}

.invoice-detail-table td {
  padding: 4px 8px;
}

.invoice-detail-table .label {
  font-weight: 600;
  color: #555;
}

/* ─── Customer Autocomplete ─── */
.customer-autocomplete {
  position: absolute;
  z-index: 1050;
  width: 100%;
  max-height: 220px;
  overflow-y: auto;
  background: white;
  border: 2px solid var(--gajaara-green);
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 6px 12px rgba(0,0,0,0.12);
}

.autocomplete-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.9em;
  transition: background 0.15s;
}

.autocomplete-item:hover,
.autocomplete-item.active {
  background-color: var(--gajaara-light);
}

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

/* ─── Khata Customer Item ─── */
.khata-customer-item {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.15s, border-left 0.15s;
  border-left: 3px solid transparent;
}

.khata-customer-item:hover {
  background: #f8f9fa;
  border-left-color: var(--color-credit);
}

.khata-customer-item.active {
  background: #fff3e0;
  border-left-color: var(--color-credit);
}

/* ─── Tables ─── */
.table thead th {
  font-size: 0.82em;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #555;
  font-weight: 700;
  border-bottom: 2px solid #dee2e6;
}

/* ─── Scrollbar ─── */
.search-results::-webkit-scrollbar,
.customer-autocomplete::-webkit-scrollbar {
  width: 6px;
}
.search-results::-webkit-scrollbar-thumb,
.customer-autocomplete::-webkit-scrollbar-thumb {
  background: var(--gajaara-green);
  border-radius: 3px;
}

*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}
*::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* ─── Print ─── */
@media print {
  .navbar, .btn, .no-print, .filter-bar, .billing-actions-sticky {
    display: none !important;
  }
}

/* ─── Mobile Responsive ─── */
@media (max-width: 991px) {
  .navbar-brand small {
    display: none;
  }
  .navbar .nav-links {
    gap: 3px;
  }
  .navbar .nav-link-btn {
    padding: 4px 8px;
    font-size: 0.75em;
  }
  .navbar .nav-link-btn span.nav-text {
    display: none;
  }
  .stat-card .stat-value {
    font-size: 1.2em;
  }
  .stat-card .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 1.1em;
  }
}

@media (max-width: 767px) {
  .navbar {
    flex-direction: row !important;
    gap: 0 !important;
    padding: 8px 12px;
  }
  .stat-card .card-body {
    padding: 0.8rem;
  }
  .stat-card .stat-value {
    font-size: 1.1em;
  }
  .filter-bar .row {
    gap: 4px;
  }
}

/* ─── Rack Location Badge ─── */
.rack-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.72em;
  font-weight: 600;
  background: #fff3cd;
  color: #664d03;
  border: 1px solid #ffecb5;
  margin-left: 6px;
}

.rack-badge-sm {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.7em;
  font-weight: 600;
  background: #fff3cd;
  color: #856404;
}

/* ─── Warranty Badge ─── */
.warranty-badge-sm {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.65em;
  font-weight: 600;
  background: #cff4fc;
  color: #055160;
  margin-left: 4px;
}

/* ─── Empty States ─── */
.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: #6c757d;
}

.empty-state i {
  opacity: 0.4;
}

.empty-state p {
  font-size: 0.95em;
}

.empty-state-mini {
  padding: 0.5rem;
}

/* ─── Success Animation Overlay ─── */
.success-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(25, 135, 84, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  animation: fadeIn 0.3s ease;
}

.success-overlay .success-text {
  color: white;
  font-size: 1.8em;
  font-weight: 700;
  margin-top: 1.5rem;
  letter-spacing: 1px;
}

.success-checkmark {
  width: 80px;
  height: 80px;
}

.check-icon {
  width: 80px;
  height: 80px;
  position: relative;
  border-radius: 50%;
  box-sizing: content-box;
  border: 4px solid white;
}

.icon-line {
  height: 5px;
  background-color: white;
  display: block;
  border-radius: 2px;
  position: absolute;
  z-index: 10;
}

.icon-line.line-tip {
  top: 46px;
  left: 14px;
  width: 25px;
  transform: rotate(45deg);
  animation: icon-line-tip 0.75s;
}

.icon-line.line-long {
  top: 38px;
  right: 8px;
  width: 47px;
  transform: rotate(-45deg);
  animation: icon-line-long 0.75s;
}

@keyframes icon-line-tip {
  0% { width: 0; left: 1px; top: 19px; }
  54% { width: 0; left: 1px; top: 19px; }
  70% { width: 50px; left: -8px; top: 37px; }
  84% { width: 17px; left: 21px; top: 48px; }
  100% { width: 25px; left: 14px; top: 46px; }
}

@keyframes icon-line-long {
  0% { width: 0; right: 46px; top: 54px; }
  65% { width: 0; right: 46px; top: 54px; }
  84% { width: 55px; right: 0; top: 35px; }
  100% { width: 47px; right: 8px; top: 38px; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ─── Table Row Hover Actions ─── */
.hover-row {
  position: relative;
}

.hover-actions {
  opacity: 0.3;
  transition: opacity 0.2s;
  display: flex;
  gap: 4px;
}

.hover-row:hover .hover-actions {
  opacity: 1;
}

/* ─── Barcode Grid ─── */
.barcode-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.barcode-label-item {
  border: 1px dashed #dee2e6;
  border-radius: 6px;
  padding: 10px;
  text-align: center;
  background: white;
  width: 210px;
}

.barcode-product-name {
  font-size: 0.78em;
  font-weight: 700;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.barcode-product-info {
  font-size: 0.7em;
  color: #6c757d;
}

/* ─── Bill Discount Input ─── */
.bill-discount-group { width: 120px; }
.bill-discount-input { width: 60px; }

/* ─── Batch Buttons ─── */
.batch-buttons-bar {
  padding: 8px 14px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.batch-btn {
  font-weight: 600;
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.82em;
  transition: transform 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.batch-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.batch-btn:active {
  transform: scale(0.96);
}

.batch-item-row {
  transition: background 0.15s;
}
.batch-item-row:hover {
  background: #e9ecef !important;
}

/* ─── Animations ─── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: fadeInUp 0.3s ease-out;
}

/* ═══════════════════════════════════════════════════
   MOBILE BOTTOM TAB BAR
   ═══════════════════════════════════════════════════ */
.mobile-tab-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid #dee2e6;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  z-index: 1030;
  padding: 4px 0;
  padding-bottom: env(safe-area-inset-bottom, 4px);
}

.mobile-tab-bar .tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: #6c757d;
  font-size: 0.65em;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 8px;
  transition: color 0.2s;
  min-width: 56px;
}

.mobile-tab-bar .tab-item i {
  font-size: 1.4em;
  margin-bottom: 2px;
}

.mobile-tab-bar .tab-item.active {
  color: var(--gajaara-green);
}

.mobile-tab-bar .tab-item:active {
  background: #e8f5e9;
}

/* ═══════════════════════════════════════════════════
   MOBILE RESPONSIVE (max-width: 767.98px)
   ═══════════════════════════════════════════════════ */
@media (max-width: 767.98px) {
  /* Show bottom tab bar */
  .mobile-tab-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
  }

  body {
    padding-bottom: 70px;
  }

  /* Navbar: keep horizontal on mobile */
  .navbar {
    flex-direction: row !important;
    gap: 0 !important;
    padding: 8px 12px !important;
  }

  .navbar-brand {
    font-size: 1.1em;
  }

  /* Container padding */
  .container-fluid, .container {
    padding-left: 10px;
    padding-right: 10px;
  }

  /* Tables: horizontal scroll */
  .table-responsive-wrapper,
  .card-body > .table,
  .card-body.p-0 > .table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table th, .table td {
    white-space: nowrap;
    font-size: 0.82em;
  }

  /* Modals: full-screen on mobile */
  .modal-dialog {
    margin: 0;
    max-width: 100%;
    min-height: 100vh;
  }

  .modal-content {
    min-height: 100vh;
    border-radius: 0;
    border: none;
  }

  /* Larger touch targets */
  .btn {
    min-height: 42px;
  }

  .form-control, .form-select {
    min-height: 44px;
    font-size: 16px !important; /* Prevents iOS zoom */
  }

  .form-control-sm, .form-select-sm {
    min-height: 40px;
    font-size: 16px !important;
  }

  /* Stat cards: 2 per row */
  .stat-card .card-body {
    padding: 0.7rem 0.8rem;
    flex-direction: column;
    text-align: center;
    gap: 0.4rem;
  }

  .stat-card .stat-icon {
    width: 36px;
    height: 36px;
    font-size: 1em;
    border-radius: 8px;
  }

  .stat-card .stat-value {
    font-size: 1em;
  }

  .stat-card .stat-label {
    font-size: 0.68em;
  }

  /* Filter bars: stack */
  .filter-bar .col-auto {
    width: 100%;
    margin-bottom: 4px;
  }

  .filter-bar .ms-auto {
    margin-left: 0 !important;
  }

  /* Search results dropdown */
  .search-results {
    width: 100% !important;
  }

  .search-result-item {
    flex-wrap: wrap;
    gap: 4px;
    padding: 12px;
  }

  /* Toast above tab bar */
  .toast-container {
    bottom: 80px !important;
  }

  /* Payment method buttons */
  .btn-group[role="group"] {
    flex-wrap: wrap;
  }

  .btn-group[role="group"] .btn {
    flex: 1 1 45%;
    border-radius: 6px !important;
    margin: 2px;
  }

  /* Hover actions: always visible (no hover on touch) */
  .hover-actions {
    opacity: 1 !important;
  }

  /* ─── Billing Page Mobile ─── */

  #billTable .qty-input {
    width: 60px !important;
    min-height: 44px;
    font-size: 16px !important;
  }

  .billing-actions-sticky {
    bottom: 64px;
    padding: 8px 0;
  }

  .batch-buttons-bar {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .batch-buttons-bar .d-flex {
    flex-wrap: nowrap !important;
  }

  /* Discount input in bill rows */
  .bill-discount-group { width: 100% !important; }
  .bill-discount-input { width: 100% !important; }

  /* ─── Admin Page Mobile ─── */
  #adminTabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  #adminTabs::-webkit-scrollbar {
    display: none;
  }

  #adminTabs .nav-item {
    flex-shrink: 0;
  }

  #adminTabs .nav-link {
    white-space: nowrap;
    font-size: 0.82em;
    padding: 8px 12px;
  }

  /* ─── Dashboard/Reports Mobile ─── */
  .chart-container canvas {
    max-height: 200px;
  }

  /* ─── Settings Mobile ─── */
  #settingsPin {
    width: 100% !important;
  }
}

/* ─── Extra Small Phones ─── */
@media (max-width: 575.98px) {
  .row.g-3 > [class*="col-sm-4"] {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .fs-4 {
    font-size: 1.1rem !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   iOS-STYLE REFINEMENT LAYER
   A cohesive "like iOS" skin over Bootstrap: SF typography, grouped
   backgrounds, soft rounded cards, hairline separators, pill buttons,
   filled inputs, and a segmented payment control.
   ═══════════════════════════════════════════════════════════════ */
:root {
  --ios-bg: #f2f2f7;              /* iOS grouped background */
  --ios-card: #ffffff;
  --ios-fill: #efeff4;           /* input fill */
  --ios-fill-2: #e9e9ee;
  --ios-separator: rgba(60, 60, 67, 0.12);
  --ios-label: #1c1c1e;
  --ios-label-2: #6b6b70;        /* secondary label */
  --ios-green: #198754;          /* brand accent (kept) */
  --ios-green-press: #14713f;
  --ios-blue: #0a84ff;
  --ios-radius: 14px;
  --ios-radius-lg: 20px;
  --ios-radius-sm: 10px;
  --ios-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 6px 20px rgba(0,0,0,0.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display',
               'Segoe UI', system-ui, Roboto, sans-serif;
  background-color: var(--ios-bg);
  color: var(--ios-label);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

/* ─── Navbar: clean solid bar with hairline ─── */
.navbar.bg-success {
  background: var(--ios-green) !important;
  box-shadow: none;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  padding: 0.55rem 1rem;
}
.navbar-brand { font-weight: 700; letter-spacing: -0.02em; }
.navbar .nav-link-btn { border-radius: 980px; font-weight: 600; }

/* ─── Cards: rounded, hairline, soft shadow ─── */
.card {
  border: 1px solid var(--ios-separator);
  border-radius: var(--ios-radius) !important;
  box-shadow: var(--ios-shadow);
  background: var(--ios-card);
  /* NOTE: no `overflow: hidden` here — the search results / customer
     autocomplete dropdowns live inside a .card and must overflow past it. */
}
.card-header {
  background: var(--ios-card);
  border-bottom: 1px solid var(--ios-separator);
  font-weight: 650;
  padding: 0.75rem 1rem;
  /* Round only the top corners so it follows the card without needing
     the card to clip overflow. */
  border-radius: var(--ios-radius) var(--ios-radius) 0 0 !important;
}
.card-header.bg-light { background: var(--ios-card) !important; }
/* Keep the branded summary header, just flatten & soften it */
.card-header.bg-success,
.modal-header.bg-success {
  background: var(--ios-green) !important;
  border-bottom: none;
}
.card-header h6, .modal-title { letter-spacing: -0.01em; }

/* ─── Buttons: iOS filled / tinted, rounded, tactile ─── */
.btn {
  border-radius: var(--ios-radius-sm);
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: transform .08s ease, filter .15s ease, background .15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-success {
  background: var(--ios-green);
  border-color: var(--ios-green);
}
.btn-success:hover, .btn-success:focus {
  background: var(--ios-green-press);
  border-color: var(--ios-green-press);
}
.btn-primary { background: var(--ios-blue); border-color: var(--ios-blue); }
/* Outline buttons → soft tinted fills (iOS "tinted" buttons) */
.btn-outline-success { color: var(--ios-green); border-color: transparent; background: rgba(25,135,84,0.10); }
.btn-outline-success:hover { background: rgba(25,135,84,0.18); color: var(--ios-green-press); border-color: transparent; }
.btn-outline-primary { color: var(--ios-blue); border-color: transparent; background: rgba(10,132,255,0.10); }
.btn-outline-primary:hover { background: rgba(10,132,255,0.18); border-color: transparent; }
.btn-outline-danger { color: #ff3b30; border-color: transparent; background: rgba(255,59,48,0.10); }
.btn-outline-danger:hover { background: rgba(255,59,48,0.18); color: #d70015; border-color: transparent; }
.btn-outline-secondary { color: var(--ios-label-2); border-color: transparent; background: var(--ios-fill); }
.btn-outline-secondary:hover { background: var(--ios-fill-2); color: var(--ios-label); border-color: transparent; }

/* ─── Form controls: filled, rounded, calm focus ─── */
.form-control, .form-select {
  border-radius: var(--ios-radius-sm);
  border: 1px solid var(--ios-separator);
  background: var(--ios-fill);
  padding: 0.55rem 0.8rem;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.form-control:focus, .form-select:focus {
  background: var(--ios-card);
  border-color: var(--ios-green);
  box-shadow: 0 0 0 3px rgba(25,135,84,0.15);
}
.form-control::placeholder { color: #a3a3a8; }
.form-label { font-weight: 600; color: var(--ios-label-2); font-size: 0.85em; }

/* Input groups: unified rounded pill container */
.input-group > .form-control,
.input-group > .form-select { background: var(--ios-card); }
.input-group-text {
  background: var(--ios-fill);
  border: 1px solid var(--ios-separator);
  color: var(--ios-label-2);
}
.input-group-lg > .form-control { font-size: 1.02rem; }

/* ─── Segmented control (payment method & any btn-check group) ─── */
.btn-group:has(.btn-check) {
  background: var(--ios-fill);
  border-radius: 12px;
  padding: 3px;
  gap: 3px;
}
.btn-group:has(.btn-check) .btn {
  border: none !important;
  border-radius: 9px !important;
  background: transparent !important;
  color: var(--ios-label-2) !important;
  font-weight: 600;
  box-shadow: none;
}
.btn-group:has(.btn-check) .btn-check:checked + .btn {
  background: var(--ios-card) !important;
  color: var(--ios-green) !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.btn-group:has(.btn-check) .btn:active { transform: scale(0.96); }

/* ─── Badges: rounded pills ─── */
.badge { border-radius: 980px; font-weight: 650; letter-spacing: 0; }

/* ─── Tables: airy, hairline rows ─── */
.table { --bs-table-bg: transparent; }
.table thead th {
  background: transparent;
  border-bottom: 1px solid var(--ios-separator);
  color: var(--ios-label-2);
}
.table > :not(caption) > * > * { border-bottom-color: var(--ios-separator); }
.table-hover > tbody > tr:hover > * { background: rgba(0,0,0,0.02); }
#billTable tbody td { padding-top: 0.7rem; padding-bottom: 0.7rem; }

/* ─── Search dropdown & quick-add: floating iOS card ─── */
.search-results, .customer-autocomplete {
  border: 1px solid var(--ios-separator);
  border-radius: var(--ios-radius);
  box-shadow: 0 10px 30px rgba(0,0,0,0.14);
  margin-top: 6px;
  overflow: hidden;
  background: rgba(255,255,255,0.98);
  backdrop-filter: saturate(180%) blur(20px);
}
.search-result-item, .autocomplete-item { border-bottom: 1px solid var(--ios-separator); }
.search-result-item:hover, .search-result-item.active,
.autocomplete-item:hover, .autocomplete-item.active {
  background-color: rgba(25,135,84,0.08);
}
.search-result-item .short-code {
  background: var(--ios-green);
  border-radius: 980px;
}
.search-result-item .product-code { color: var(--ios-green); }

/* Quick-add new product form (inside the search dropdown) */
.quick-add-box { padding: 14px 16px; }
.quick-add-box .form-label { margin-bottom: 2px; }
.quick-add-box .btn-success { padding: 0.6rem; font-size: 0.98em; }
.quick-add-box .form-text { color: var(--ios-label-2); }

/* "Not listed? Add as new product" footer row in search results */
.search-add-new {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 0.9em;
  color: var(--ios-green);
  background: rgba(25,135,84,0.06);
  border-top: 1px solid var(--ios-separator);
  transition: background .15s ease;
  position: sticky;
  bottom: 0;
}
.search-add-new:hover { background: rgba(25,135,84,0.14); }

/* Duplicate-guard warning banner */
.dup-warn {
  background: #fff8e6;
  color: #7a5b00;
  font-size: 0.82em;
  font-weight: 600;
  padding: 10px 16px;
  border-bottom: 1px solid var(--ios-separator);
}

/* ─── "New items to set up" card (Admin) ─── */
.needs-setup-card {
  border: 1px solid rgba(255,159,10,0.35);
  background: linear-gradient(0deg, var(--ios-card), var(--ios-card));
}
.needs-setup-card .card-header {
  background: #fff8e6;
  color: #7a5b00;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,159,10,0.25);
}

/* ─── Modals: iOS sheet ─── */
.modal-content {
  border: none;
  border-radius: var(--ios-radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  overflow: hidden;
}
.modal-header { border-bottom: 1px solid var(--ios-separator); }
.modal-footer { border-top: 1px solid var(--ios-separator); }

/* ─── Toasts: rounded, blurred ─── */
.toast {
  border-radius: var(--ios-radius);
  box-shadow: 0 8px 30px rgba(0,0,0,0.22);
  backdrop-filter: saturate(180%) blur(20px);
}

/* ─── Sticky action buttons ─── */
.billing-actions-sticky {
  background: rgba(242,242,247,0.85);
  backdrop-filter: saturate(180%) blur(20px);
  border-radius: var(--ios-radius) var(--ios-radius) 0 0;
}
.billing-actions-sticky .btn-complete,
.billing-actions-sticky .btn-hold { border-radius: var(--ios-radius); }

/* ─── Mobile bottom tab bar: frosted ─── */
.mobile-tab-bar {
  background: rgba(255,255,255,0.9);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--ios-separator);
}
.mobile-tab-bar .tab-item.active { color: var(--ios-green); }

/* ─── Batch / quick chips ─── */
.batch-buttons-bar { background: var(--ios-card); border: 1px solid var(--ios-separator); border-radius: var(--ios-radius); }
.batch-btn { border-radius: 980px; }

/* Keep the tinted-button rule from washing out solid nav pills */
.navbar .btn-outline-light { background: transparent; border-color: rgba(255,255,255,0.4); color: #fff; }

/* No-match hint under the search bar (full form opens in a popup) */
.search-no-match { padding: 12px 16px; }

/* ═══════════════════════════════════════════════════════════════
   GAJARA & GAJAARA BRAND LAYER
   Letterhead blue as the accent, logo in the header, and the
   redesigned billing screen (search, bill rows, customer, summary).
   ═══════════════════════════════════════════════════════════════ */
:root {
  --ios-green: #1c3f8c;          /* accent: the blue of the printed bill */
  --ios-green-press: #15306b;
  --brand: #1c3f8c;
  --brand-2: #2f5bc4;
  --brand-soft: rgba(28, 63, 140, 0.08);
  --saffron: #f59f00;
  --money: #198754;
}

/* Header: logo + shop name */
.navbar.bg-success {
  background: linear-gradient(100deg, #15306b 0%, #1c3f8c 55%, #2f5bc4 100%) !important;
  border-bottom: 3px solid var(--saffron);
}
.navbar-brand { display: flex; align-items: center; gap: 10px; letter-spacing: 0; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 50%;
  background: #fff; padding: 2px; object-fit: contain;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.35);
}
.brand-text {
  display: flex; flex-direction: column; line-height: 1.1;
  font-family: Georgia, 'Times New Roman', serif; font-size: 1.25rem;
}
.brand-text small {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 0.62rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.85;
}
.navbar .nav-link-btn.active { color: var(--brand); }
.card-header.bg-success, .modal-header.bg-success { background: var(--brand) !important; }
.btn-success { --bs-btn-bg: var(--money); --bs-btn-border-color: var(--money); }

/* Edit-mode banner */
.edit-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #fff4d6; color: #6b4a00; border-bottom: 1px solid #f3d27a;
  padding: 10px 16px; font-size: 0.92rem;
}
body.editing .bill-card { box-shadow: 0 0 0 2px #f3c44c, var(--ios-shadow); }

.billing-layout { padding-top: 16px; padding-bottom: 24px; }

/* Search */
.search-panel { position: relative; margin-bottom: 12px; }
.search-box {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1.5px solid transparent; border-radius: 16px;
  padding: 6px 8px 6px 16px; box-shadow: var(--ios-shadow);
  transition: border-color .15s, box-shadow .15s;
}
.search-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(28,63,140,0.12), var(--ios-shadow); }
.search-box .search-icon { color: var(--brand); font-size: 1.15rem; }
.search-box input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font-size: 1.08rem; padding: 10px 0; min-width: 0;
}
.search-scan {
  border: 0; background: var(--brand-soft); color: var(--brand);
  width: 44px; height: 44px; border-radius: 12px; font-size: 1.2rem;
}
.search-scan:hover { background: rgba(28,63,140,0.15); }
.search-panel .search-results { width: 100%; left: 0; }
.kbd {
  display: inline-block; font-size: 0.72rem; font-weight: 600; color: var(--ios-label-2);
  border: 1px solid var(--ios-separator); border-bottom-width: 2px; border-radius: 6px;
  padding: 1px 6px; background: #fff; margin: 0 2px;
}

/* Quick kits */
.batch-buttons-bar {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 12px;
}
.batch-label { font-size: 0.8rem; font-weight: 700; color: var(--saffron); white-space: nowrap; }
.batch-btn {
  border: 1px solid rgba(28,63,140,0.25); background: #fff; color: var(--brand);
  padding: 5px 12px; font-size: 0.85rem; font-weight: 600;
}
.batch-btn:hover { background: var(--brand-soft); }
.batch-count { background: var(--brand); color: #fff; border-radius: 980px; font-size: 0.7rem; padding: 1px 7px; margin-left: 4px; }

/* Bill card */
.bill-card { background: #fff; border-radius: var(--ios-radius-lg); box-shadow: var(--ios-shadow); overflow: hidden; }
.bill-card-header {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--ios-separator);
}
.bill-card-header h6 { font-weight: 700; color: var(--brand); }
.item-count {
  background: var(--brand-soft); color: var(--brand); border-radius: 980px;
  font-size: 0.75rem; font-weight: 600; padding: 2px 9px; margin-left: 6px;
}
.draft-status { font-size: 0.75rem; color: var(--money); margin-top: 2px; min-height: 1em; }

.bill-table thead th {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ios-label-2); font-weight: 700; padding: 10px 12px; white-space: nowrap;
}
.bill-table tbody td { padding: 12px; vertical-align: middle; }
.bill-table tbody tr:hover > * { background: rgba(28,63,140,0.025); }
.bill-table tr.over-stock > * { background: #fff8e6 !important; }
.item-name { font-weight: 600; color: var(--ios-label); }
.item-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 0.7rem; font-weight: 600; border-radius: 6px; padding: 1px 7px;
  background: #eef1f7; color: #4a5672; font-family: ui-monospace, Menlo, Consolas, monospace;
}
.chip-soft { background: var(--brand-soft); color: var(--brand); }
.chip-rack { background: #fff1db; color: #8a5300; font-family: inherit; }
.chip-warranty { background: #e8f6ee; color: #146c43; font-family: inherit; }
.chip-new { background: #e0f2ff; color: #0b5ea8; font-family: inherit; }
.chip-danger { background: #fde8ea; color: #b02a37; font-family: inherit; }
.rate { color: var(--ios-label-2); white-space: nowrap; }
.rate-input { width: 100px; margin-left: auto; text-align: right; }
.line-total { font-weight: 700; white-space: nowrap; }
.stock-warn { font-size: 0.72rem; color: #b26a00; text-align: center; margin-top: 3px; }

.qty-stepper {
  display: inline-flex; align-items: center; background: var(--ios-fill);
  border-radius: 12px; padding: 3px; margin: 0 auto;
}
.bill-table td .qty-stepper { display: flex; width: max-content; }
.qty-stepper button {
  width: 34px; height: 34px; border: 0; border-radius: 9px; background: #fff;
  color: var(--brand); font-size: 1.1rem; box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.qty-stepper button:disabled { color: #c3c7d0; box-shadow: none; background: transparent; }
.qty-stepper button:active:not(:disabled) { transform: scale(0.94); }
.qty-stepper input {
  width: 46px; border: 0; background: transparent; text-align: center;
  font-weight: 700; font-size: 1rem; -moz-appearance: textfield;
}
.qty-stepper input::-webkit-outer-spin-button,
.qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.btn-remove {
  border: 0; background: transparent; color: #b0b4bd; width: 32px; height: 32px; border-radius: 8px;
}
.btn-remove:hover { background: #fde8ea; color: #dc3545; }

.empty-row td { border: 0 !important; }
.empty-state .empty-icon {
  width: 64px; height: 64px; margin: 8px auto 10px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand); font-size: 1.8rem;
}
.kbd-hints { margin-top: 12px; font-size: 0.78rem; color: var(--ios-label-2); }

/* Side cards: customer + summary */
.side-card {
  background: #fff; border-radius: var(--ios-radius-lg); box-shadow: var(--ios-shadow);
  padding: 16px; margin-bottom: 12px;
}
.side-card-title { font-weight: 700; color: var(--brand); margin-bottom: 10px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.field-label { display: block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ios-label-2); margin-bottom: 3px; }
.returning-chip {
  margin-left: auto; font-size: 0.72rem; font-weight: 600; color: var(--money);
  background: #e8f6ee; border-radius: 980px; padding: 2px 9px;
}
#customerCard .form-control { font-size: 0.98rem; }
#customerCard .input-group .customer-autocomplete { top: 100%; left: 0; }
.ac-village { font-size: 0.78rem; color: var(--brand); margin-left: 8px; }
.ac-village i { margin-right: 2px; }
.more-toggle {
  border: 0; background: transparent; color: var(--brand); font-size: 0.85rem; font-weight: 600;
  padding: 6px 0 0;
}

.summary-card .sum-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; gap: 10px; }
.summary-card .sum-row > span:first-child { color: var(--ios-label-2); font-weight: 600; }
.sum-value { font-weight: 700; font-size: 1.05rem; }
.sum-input { display: flex; align-items: center; gap: 6px; }
.sum-input .form-control { width: 110px; font-weight: 600; }
.sum-sub { text-align: right; font-size: 0.78rem; color: var(--ios-label-2); min-height: 0.5em; }
.seg { display: inline-flex; background: var(--ios-fill); border-radius: 9px; padding: 2px; }
.seg-btn { border: 0; background: transparent; border-radius: 7px; padding: 3px 10px; font-size: 0.8rem; font-weight: 700; color: var(--ios-label-2); }
.seg-btn.active { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.final-box {
  margin-top: 10px; padding: 14px; border-radius: 14px;
  background: linear-gradient(135deg, #15306b, #1c3f8c 60%, #2f5bc4); color: #fff;
}
.final-label { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; opacity: 0.85; }
.final-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; }
.final-words { font-size: 0.8rem; opacity: 0.9; font-style: italic; margin-top: 2px; }

.pay-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pay-pill {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: 1.5px solid var(--ios-separator); border-radius: 12px; padding: 8px 4px;
  font-size: 0.8rem; font-weight: 600; color: var(--ios-label-2); cursor: pointer; background: #fff;
  transition: all .15s;
}
.pay-pill i { font-size: 1.15rem; }
.btn-check:checked + .pay-pill { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
#payCredit:checked + .pay-pill { border-color: #d98b00; background: #fff4d6; color: #8a5300; }

.billing-actions-sticky { padding: 12px 0; background: transparent; backdrop-filter: none; }
.billing-actions-sticky .btn-complete {
  background: linear-gradient(135deg, #198754, #20a466); border: 0; font-size: 1.1rem; padding: 14px;
  box-shadow: 0 8px 20px rgba(25,135,84,0.28);
}
.billing-actions-sticky .btn-hold {
  background: #fff; border: 1.5px solid #f0c36d; color: #8a5300; font-weight: 600;
}
.billing-actions-sticky .btn-hold:hover:not(:disabled) { background: #fff8e6; }

/* Held bills sidebar */
#heldBillsSidebar .offcanvas-header { background: var(--brand); color: #fff; }
#heldBillsSidebar .btn-close { filter: invert(1) grayscale(1) brightness(2); }
.held-bill-card { border-radius: 14px; border: 1px solid var(--ios-separator); }
.held-bill-card:hover { border-color: var(--brand); }

/* Completion modal */
.done-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.done-billno { font-size: 1.3rem; font-weight: 800; color: var(--brand); }
.done-amount { font-size: 1.8rem; font-weight: 800; color: var(--money); }
.done-totals { max-width: 340px; margin-left: auto; }
.done-totals > div { display: flex; justify-content: space-between; padding: 2px 0; }
.done-totals .done-final { border-top: 2px solid var(--brand); margin-top: 4px; padding-top: 6px; font-weight: 800; color: var(--brand); font-size: 1.1rem; }
.done-totals .final-words { color: var(--ios-label-2); display: block; text-align: right; }

/* Admin product form */
.admin-form .card, #productForm { border-radius: var(--ios-radius-lg); }

@media (max-width: 991.98px) {
  .brand-text { font-size: 1.05rem; }
  .brand-text small { display: none; }
}
@media (max-width: 767.98px) {
  .billing-layout { padding-top: 10px; }
  .bill-table thead { display: none; }
  .bill-table tbody tr:not(.empty-row) {
    display: grid; grid-template-columns: 1fr auto; grid-template-areas:
      "item remove" "rate rate" "qty total"; padding: 10px 12px; border-bottom: 1px solid var(--ios-separator);
  }
  .bill-table tbody tr:not(.empty-row) > td { border: 0; padding: 2px 0; }
  .bill-table tbody tr:not(.empty-row) > td:nth-child(1) { display: none; }
  .bill-table tbody tr:not(.empty-row) > td:nth-child(2) { grid-area: item; }
  .bill-table tbody tr:not(.empty-row) > td:nth-child(3) { grid-area: rate; text-align: left !important; font-size: 0.85rem; }
  .bill-table .rate-input { margin-left: 0; }
  .bill-table tbody tr:not(.empty-row) > td:nth-child(4) { grid-area: qty; }
  .bill-table tbody tr:not(.empty-row) > td:nth-child(5) { grid-area: total; align-self: center; font-size: 1.05rem; }
  .bill-table tbody tr:not(.empty-row) > td:nth-child(6) { grid-area: remove; }
  .bill-table td .qty-stepper { margin: 4px 0 0; }
  .billing-actions-sticky { bottom: 64px; background: rgba(242,242,247,0.92); backdrop-filter: blur(16px); padding: 8px 0; }
  .final-value { font-size: 1.6rem; }
  .pay-pill { font-size: 0.75rem; }
}
@media print { .edit-banner { display: none !important; } }
.billing-actions-sticky .btn-complete.busy { opacity: 0.75; cursor: progress; }

/* Desktop: action buttons sit after the payment options (no overlap); phones keep them pinned */
@media (min-width: 768px) {
  .billing-page .billing-actions-sticky { position: static; padding-top: 4px; }
}
body.editing #btnHoldBill { display: none; }
