/* ══════════════════════════════════════════════════════════
   InvoiceFlow — inventory.css  (JEWELLERY EDITION)
   Diamond & Coloured Stone Inventory
   Matches Create Invoice tab aesthetic exactly:
   · Cream bg · Deep navy header · Gold accents
   · Same radius, shadow, typography, spacing
   Load AFTER style.css
   Does NOT touch Create Invoice or History tabs
══════════════════════════════════════════════════════════ */

/* ── Tab container ──────────────────────────────────────── */
#tab-inventory {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 28px 60px;
}

/* ══════════════════════════════════════════════════════════
   STATS STRIP
══════════════════════════════════════════════════════════ */
.inv-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.inv-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: box-shadow var(--transition);
}

.inv-stat-card:hover { box-shadow: var(--shadow); }

.inv-stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-light);
}

.inv-stat-value {
  font-family: 'DM Mono', monospace;
  font-size: 28px;
  font-weight: 500;
  color: var(--accent);
  line-height: 1.1;
}

.inv-stat-card.stat-warning .inv-stat-value { color: #B07020; }
.inv-stat-card.stat-danger  .inv-stat-value { color: var(--danger); }

/* ══════════════════════════════════════════════════════════
   LAYOUT — Left form / Right table
══════════════════════════════════════════════════════════ */
.inv-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  align-items: start;
}

/* ══════════════════════════════════════════════════════════
   LEFT CARD — Add / Edit Form
   Matches .cp-section from Create Invoice tab
══════════════════════════════════════════════════════════ */
.inv-form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 80px;
  overflow: hidden;
}

/* Navy header bar — same as Create Invoice section titles */
.inv-gem-header {
  background: var(--accent);
  padding: 16px 20px;
  margin: 0;
  border-bottom: none;
  border-radius: 0;
  gap: 10px;
}

.inv-gem-header .card-title {
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.inv-gem-header .card-icon {
  font-size: 16px;
}

/* Form body padding */
.inv-form-card > *:not(.inv-gem-header):not(.inv-editing-banner) {
  padding-left: 20px;
  padding-right: 20px;
}

.inv-form-card > .form-group { padding-left: 20px; padding-right: 20px; }
.inv-form-card > .inv-row-2  { padding-left: 20px; padding-right: 20px; }
.inv-form-card > .inv-row-3  { padding-left: 20px; padding-right: 20px; }
.inv-form-card > .inv-section-label { padding-left: 20px; padding-right: 20px; }
.inv-form-card > .inv-form-actions  { padding-left: 20px; padding-right: 20px; }

/* Editing mode — gold border */
.inv-form-card.editing-mode {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200,154,58,0.14), var(--shadow);
}

.inv-editing-banner {
  display: none;
  background: rgba(200,154,58,0.09);
  border-bottom: 1px solid rgba(200,154,58,0.25);
  padding: 9px 20px;
  font-size: 12.5px;
  font-weight: 600;
  color: #8A6010;
  align-items: center;
  gap: 8px;
}

.inv-form-card.editing-mode .inv-editing-banner { display: flex; }

/* ── Section label dividers (like compact-bar titles) ───── */
.inv-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold);
  padding-top: 16px !important;
  padding-bottom: 6px !important;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

/* First section label — no top border since it follows header/banner */
.inv-form-card .inv-section-label:first-of-type {
  padding-top: 18px !important;
  border-top: none;
}

/* ── Compact form inputs ──────────────────────────────────  */
.inv-form-card .form-group {
  margin-bottom: 10px;
}

.inv-form-card .form-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mid);
  margin-bottom: 4px;
}

.inv-form-card .form-input {
  padding: 9px 12px;
  font-size: 14px;
  border-radius: var(--radius-sm);
}

.inv-form-card .form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(28,53,87,0.09);
}

/* ── Select dropdown arrow ──────────────────────────────── */
.inv-select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='7' viewBox='0 0 11 7'%3E%3Cpath d='M1 1l4.5 4.5L10 1' stroke='%238A8580' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px !important;
}

/* ── Two-column form rows ────────────────────────────────── */
.inv-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

/* ── Three-column form rows ─────────────────────────────── */
.inv-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.inv-row-2 .form-group,
.inv-row-3 .form-group {
  margin-bottom: 0;
}

/* ── Input with unit suffix (ct, ₹) ─────────────────────── */
.inv-input-unit-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.inv-input-unit {
  position: absolute;
  right: 11px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-light);
  pointer-events: none;
  letter-spacing: 0.04em;
}

.inv-input-prefix {
  position: absolute;
  left: 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-mid);
  pointer-events: none;
}

.inv-input-with-prefix {
  padding-left: 24px !important;
}

/* ── Final Value display ────────────────────────────────── */
.inv-final-label {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.inv-calc-hint {
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-faint);
  text-transform: none;
  letter-spacing: 0;
}

.inv-final-display {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 11px 16px;
  background: rgba(28,53,87,0.04);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Mono', monospace;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink-light);
  letter-spacing: 0.03em;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  min-height: 42px;
}

.inv-final-display--filled {
  color: var(--accent);
  border-color: rgba(200,154,58,0.4);
  background: rgba(200,154,58,0.05);
}

/* ── Save / Cancel buttons ──────────────────────────────── */
.inv-form-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 16px !important;
  padding-bottom: 20px !important;
  border-top: 1px solid var(--border);
  margin-top: 14px;
}

.inv-form-actions .btn {
  width: 100%;
  justify-content: center;
  padding: 11px 16px;
  font-size: 14px;
}

/* ══════════════════════════════════════════════════════════
   RIGHT CARD — Products Table
══════════════════════════════════════════════════════════ */
.inv-table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.inv-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.inv-table-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inv-count-badge {
  background: rgba(28,53,87,0.08);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  font-family: 'DM Mono', monospace;
}

/* ── Search input ────────────────────────────────────────── */
.inv-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.inv-search-icon {
  position: absolute;
  left: 12px;
  font-size: 14px;
  pointer-events: none;
  color: var(--ink-faint);
}

.inv-search-input {
  width: 240px;
  padding: 8px 14px 8px 36px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--bg);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.inv-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(28,53,87,0.09);
  background: var(--surface);
}

.inv-search-input::placeholder { color: var(--ink-faint); }

/* ══════════════════════════════════════════════════════════
   PRODUCTS TABLE
══════════════════════════════════════════════════════════ */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.products-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

/* Navy header — exact match to history table */
.products-table thead {
  background: var(--accent);
}

.products-table thead th {
  padding: 12px 14px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.65);
  white-space: nowrap;
}

.products-table thead th.tc-num { text-align: right; }
.products-table thead th:last-child { text-align: center; }

/* Rows */
.products-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.products-table tbody tr:last-child { border-bottom: none; }
.products-table tbody tr:hover      { background: var(--bg); }

.products-table td {
  padding: 12px 14px;
  color: var(--ink-mid);
  vertical-align: middle;
}

/* Number-aligned cells */
.products-table td.tc-num {
  text-align: right;
  font-family: 'DM Mono', monospace;
}

/* ── Cell-specific styles ───────────────────────────────── */
.inv-name-cell {
  display: block;
  font-weight: 600;
  color: var(--ink);
  font-size: 13.5px;
  white-space: nowrap;
}

.inv-type-sub {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-faint);
  margin-top: 1px;
}

.inv-td-carat,
.inv-td-ppc {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: var(--ink-mid);
}

/* Final value column — gold tint */
.inv-final-col {
  font-weight: 700 !important;
  color: var(--accent) !important;
  font-size: 13.5px !important;
}

.inv-td-clarity,
.inv-td-color,
.inv-td-cut,
.inv-td-shape,
.inv-td-type {
  font-size: 13px;
  white-space: nowrap;
}

.inv-cell-faint {
  color: var(--ink-faint);
  font-size: 12px;
}

/* ── Low stock ──────────────────────────────────────────── */
.products-table tbody tr.low-stock {
  background: rgba(176,64,64,0.03);
}

.products-table tbody tr.low-stock:hover {
  background: rgba(176,64,64,0.06);
}

.products-table td.td-stock {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  text-align: right;
}

.products-table tbody tr.low-stock td.td-stock { color: var(--danger); }

/* Stock badges */
.badge-low-stock {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  border: 1px solid rgba(176,64,64,0.18);
  margin-left: 5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  vertical-align: middle;
  font-family: 'DM Sans', sans-serif;
}

.badge-out-stock {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(176,64,64,0.14);
  color: var(--danger);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  border: 1px solid rgba(176,64,64,0.28);
  margin-left: 5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  vertical-align: middle;
  font-family: 'DM Sans', sans-serif;
}

/* ── Stone type badges ──────────────────────────────────── */
.inv-stone-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-family: 'DM Sans', sans-serif;
  white-space: nowrap;
}

.inv-stone--diamond    { background: #EEF4FF; color: #1e40af; border: 1px solid #bfdbfe; }
.inv-stone--ruby       { background: #FFF0F0; color: #991b1b; border: 1px solid #fecaca; }
.inv-stone--emerald    { background: #ECFDF5; color: #065f46; border: 1px solid #a7f3d0; }
.inv-stone--sapphire   { background: #EFF6FF; color: #1d4ed8; border: 1px solid #bfdbfe; }
.inv-stone--alexandrite{ background: #F5F0FF; color: #6d28d9; border: 1px solid #ddd6fe; }
.inv-stone--tanzanite  { background: #F0F0FF; color: #4338ca; border: 1px solid #c7d2fe; }
.inv-stone--custom     { background: #F5F3EE; color: #6b7280; border: 1px solid #e5e7eb; }

/* ── Certification badges ───────────────────────────────── */
.inv-cert-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-family: 'DM Sans', sans-serif;
  white-space: nowrap;
}

.inv-cert--gia { background: #FEF3C7; color: #92400e; border: 1px solid #fde68a; }
.inv-cert--igi { background: #D1FAE5; color: #065f46; border: 1px solid #a7f3d0; }
.inv-cert--hrd { background: #EDE9FE; color: #5b21b6; border: 1px solid #ddd6fe; }
.inv-cert--ags { background: #DBEAFE; color: #1e3a8a; border: 1px solid #bfdbfe; }

/* ── Barcode column ─────────────────────────────────────── */
.products-table td.td-barcode { white-space: nowrap; }

.td-barcode-num {
  display: block;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--ink-light);
  letter-spacing: 0.04em;
  margin-bottom: 5px;
}

.btn-view-barcode {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(28,53,87,0.07);
  color: var(--accent);
  border: 1px solid rgba(28,53,87,0.16);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background var(--transition);
}

.btn-view-barcode:hover {
  background: rgba(28,53,87,0.13);
}

/* ── Actions column ─────────────────────────────────────── */
.products-table td.td-actions { text-align: center; }

/* ══════════════════════════════════════════════════════════
   INVOICE DROPDOWN INTEGRATION (unchanged)
══════════════════════════════════════════════════════════ */
.item-product-select {
  padding: 6px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 12.5px;
  color: var(--ink-light);
  background: var(--bg);
  outline: none;
  transition: border-color var(--transition);
  cursor: pointer;
  width: 100%;
  margin-bottom: 4px;
}

.item-product-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(28,53,87,0.08);
  background: var(--surface);
}

.item-stock-hint {
  font-size: 10.5px;
  color: var(--ink-faint);
  padding-left: 2px;
  line-height: 1;
  transition: color var(--transition);
}

.item-stock-hint.hint-low { color: #B07020; font-weight: 600; }
.item-stock-hint.hint-out { color: var(--danger); font-weight: 600; }
.item-stock-hint.hint-ok  { color: var(--success); }

/* ══════════════════════════════════════════════════════════
   DELETE MODAL — reuses existing modal styles from style.css
══════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════
   BARCODE MODAL
══════════════════════════════════════════════════════════ */
.barcode-preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 22px 16px 10px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

#barcodePreviewSvg { max-width: 100%; }

.barcode-product-name {
  margin-top: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
}

.barcode-number-label {
  margin-top: 4px;
  font-family: 'DM Mono', monospace;
  font-size: 12.5px;
  color: var(--ink-light);
  letter-spacing: 0.08em;
  text-align: center;
}

/* ══════════════════════════════════════════════════════════
   BARCODE SCANNER (invoice page — unchanged)
══════════════════════════════════════════════════════════ */
.barcode-scan-section { margin-bottom: 0; }

.barcode-scan-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.barcode-input-wrap {
  position: relative;
  flex: 1;
}

.barcode-scan-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--ink-faint);
  pointer-events: none;
}

.barcode-scan-input {
  width: 100%;
  padding-left: 36px !important;
  font-family: 'DM Mono', monospace;
  font-size: 13.5px;
  letter-spacing: 0.04em;
}

.barcode-scan-btn  { white-space: nowrap; padding: 9px 20px; font-size: 14px; flex-shrink: 0; }

.barcode-scan-status {
  min-height: 18px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
  padding-left: 2px;
  transition: color 0.2s;
}

.barcode-scan-status.status-ok    { color: var(--success); }
.barcode-scan-status.status-error { color: var(--danger);  }
.barcode-scan-status.status-info  { color: var(--ink-light); }

.barcode-camera-btn {
  white-space: nowrap;
  padding: 9px 16px;
  font-size: 13.5px;
  flex-shrink: 0;
  border: 1.5px solid var(--border);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.barcode-camera-btn.active {
  background: rgba(176,64,64,0.08);
  border-color: var(--danger);
  color: var(--danger);
}

.camera-scan-panel {
  margin-top: 14px;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #000;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.camera-scan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--accent);
  padding: 10px 16px;
}

.camera-scan-label  { font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.9); letter-spacing: 0.02em; }

.camera-close-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 18px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.camera-close-btn:hover { background: rgba(255,255,255,0.28); }

.camera-preview-region { width: 100%; max-height: 300px; background: #111; }
.camera-preview-region video { width: 100% !important; max-height: 280px; object-fit: cover; display: block; }
.camera-preview-region canvas { position: absolute; }

.camera-status-line {
  background: #1a1a1a;
  color: #ccc;
  font-size: 12.5px;
  font-weight: 500;
  padding: 8px 16px;
  text-align: center;
  letter-spacing: 0.03em;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
}

/* Scan flash animations */
@keyframes rowFlashOk  { 0% { background: rgba(26,122,60,0.18); } 100% { background: transparent; } }
@keyframes rowFlashErr { 0% { background: rgba(176,64,64,0.18); } 100% { background: transparent; } }
.item-row.scan-ok  { animation: rowFlashOk  1s ease forwards; }
.item-row.scan-err { animation: rowFlashErr 1s ease forwards; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */

/* Tablet — stack */
@media (max-width: 900px) {
  .inv-layout {
    grid-template-columns: 1fr;
  }

  .inv-form-card {
    position: static;
  }

  .inv-stats {
    grid-template-columns: 1fr 1fr;
  }
}

/* Mobile */
@media (max-width: 600px) {
  #tab-inventory { padding: 16px 14px 50px; }

  .inv-stats { grid-template-columns: 1fr; }

  .inv-table-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .inv-search-input { width: 100%; }

  .products-table { font-size: 13px; }
  .products-table thead th,
  .products-table td { padding: 10px 10px; }

  .inv-row-3 {
    grid-template-columns: 1fr 1fr;
  }

  .barcode-scan-row { flex-wrap: wrap; }
  .barcode-camera-btn { width: 100%; justify-content: center; }
  .camera-preview-region { max-height: 240px; }
}

/* Small mobile */
@media (max-width: 400px) {
  .inv-row-2,
  .inv-row-3 {
    grid-template-columns: 1fr;
  }
}


/* ══════════════════════════════════════════════════════════
   ▼▼▼  MERGED FROM inventory-fullwidth.css  ▼▼▼
   Full-width layout overrides + Inventory Upgrades.
   Load order preserved — overrides apply after base styles.
══════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════
   inventory-fullwidth.css
   Full-width layout overrides for the Inventory tab.
   Load AFTER: style.css → inventory.css
   Does NOT affect History or Create Invoice tabs.
══════════════════════════════════════════════════════════ */


/* ── 1. Remove max-width, full viewport width ───────────── */
#tab-inventory {
  max-width: 100% !important;
  margin: 0 !important;
  padding: 32px 48px 60px !important;
}


/* ── 2. Fixed 360px form / remaining space for table ────── */
.inv-layout {
  grid-template-columns: 360px 1fr !important;
  gap: 28px !important;
}


/* ── 3. Products table card — stretch full width ─────────── */
.inv-table-card {
  width: 100%;
  min-width: 0;
}

.products-table {
  width: 100%;
  table-layout: auto;
}


/* ── 4. Stats strip — use full width ─────────────────────── */
.inv-stats {
  width: 100%;
}


/* ── 5. Tablet (≤ 1100px) — tighten padding slightly ────── */
@media (max-width: 1100px) {
  #tab-inventory {
    padding: 28px 32px 60px !important;
  }

  .inv-layout {
    gap: 20px !important;
  }
}


/* ── 6. Tablet portrait (≤ 900px) — stack columns ───────── */
@media (max-width: 900px) {
  #tab-inventory {
    padding: 24px 24px 48px !important;
  }

  /* Stacked: inventory.css already sets grid-template-columns: 1fr here,
     so we just ensure our override is consistent */
  .inv-layout {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
}


/* ── 7. Mobile (≤ 600px) ────────────────────────────────── */
@media (max-width: 600px) {
  #tab-inventory {
    padding: 16px 16px 40px !important;
  }
}

/* ══════════════════════════════════════════════════════════
   INVENTORY UPGRADES — Icon Buttons, Filter Bar, Sort,
   Badges, Sticky Header, Zebra Rows
   Load AFTER: inventory-fullwidth.css
══════════════════════════════════════════════════════════ */


/* ── Sticky table header ─────────────────────────────────── */
#invTableWrap {
  overflow-x: auto;
  overflow-y: visible;
  max-height: none;
  height: auto;
}

.products-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--accent, #1C3557);
  color: #fff;
  user-select: none;
}


/* ── Zebra row striping ──────────────────────────────────── */
.products-table tbody tr:nth-child(even) {
  background: rgba(28, 53, 87, 0.03);
}

.products-table tbody tr:hover {
  background: rgba(28, 53, 87, 0.07) !important;
}


/* ── Sortable column headers ─────────────────────────────── */
.inv-th-sort {
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  padding-right: 6px;
}

.inv-th-sort:hover {
  background: rgba(255,255,255,0.1) !important;
}

.inv-th-sort.inv-th--asc,
.inv-th-sort.inv-th--desc {
  background: rgba(255,255,255,0.15) !important;
}

.inv-sort-icon {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: #f0d080;
  min-width: 12px;
}

.th-actions {
  text-align: center;
  min-width: 160px;
}


/* ── Advanced Filter Bar ─────────────────────────────────── */
.inv-adv-filter-bar {
  background: var(--surface, #f8f9fb);
  border: 1px solid var(--border, #e4e8ef);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.inv-filter-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.inv-filter-row--ranges {
  padding-top: 4px;
  border-top: 1px solid var(--border, #e4e8ef);
}

.inv-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inv-filter-group--reset {
  margin-left: auto;
}

.inv-filter-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-light, #888);
  white-space: nowrap;
}

.inv-filter-select,
.inv-filter-input {
  padding: 8px 12px;
  border: 1.5px solid var(--border, #e4e8ef);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--ink, #222);
  background: var(--bg, #fff);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.inv-filter-select {
  cursor: pointer;
  min-width: 130px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.inv-filter-select:focus,
.inv-filter-input:focus {
  border-color: var(--accent, #1C3557);
  box-shadow: 0 0 0 3px rgba(28,53,87,0.09);
}

/* Range pair (min — max inputs) */
.inv-range-pair {
  display: flex;
  align-items: center;
  gap: 6px;
}

.inv-range-input {
  width: 80px;
  text-align: center;
}

.inv-range-sep {
  color: var(--ink-light, #888);
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

/* Reset button */
.btn-inv-reset {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #b91c1c;
  background: #fef2f2;
  border: 1.5px solid #fca5a5;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s, border-color 0.18s;
}

.btn-inv-reset:hover {
  background: #fee2e2;
  border-color: #f87171;
}


/* ── Icon Action Buttons ─────────────────────────────────── */
.inv-action-btns {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.inv-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  cursor: pointer;
  background: #f1f5f9;
  color: #475569;
  transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.12s, box-shadow 0.18s;
  flex-shrink: 0;
  padding: 0;
  position: relative;
}

.inv-icon-btn svg {
  width: 15px;
  height: 15px;
  pointer-events: none;
}

.inv-icon-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

/* View — blue */
.inv-icon-btn--view {
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
}
.inv-icon-btn--view:hover {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #93c5fd;
}

/* Edit — amber */
.inv-icon-btn--edit {
  background: #fffbeb;
  color: #d97706;
  border-color: #fde68a;
}
.inv-icon-btn--edit:hover {
  background: #fef3c7;
  color: #b45309;
  border-color: #fcd34d;
}

/* Duplicate — purple */
.inv-icon-btn--dupe {
  background: #faf5ff;
  color: #7c3aed;
  border-color: #ddd6fe;
}
.inv-icon-btn--dupe:hover {
  background: #ede9fe;
  color: #6d28d9;
  border-color: #c4b5fd;
}

/* Delete — red */
.inv-icon-btn--delete {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}
.inv-icon-btn--delete:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
  box-shadow: 0 4px 12px rgba(220,38,38,0.2);
}

/* Tooltip via title attr — native tooltip is fine; add aria support */
.inv-icon-btn:active {
  transform: translateY(0);
  box-shadow: none;
}


/* ── Stock Badges ────────────────────────────────────────── */
.inv-stock-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.inv-stock-badge--low {
  background: #fef9c3;
  color: #854d0e;
  border: 1px solid #fde047;
}

.inv-stock-badge--out {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* Existing inv-cert-badge improvements */
.inv-cert-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.inv-cert--gia {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.inv-cert--igi {
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.inv-cert--hrd {
  background: #faf5ff;
  color: #7c3aed;
  border: 1px solid #ddd6fe;
}

.inv-cert--ags {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

/* Remove old badge styles that may conflict */
.badge-low-stock,
.badge-out-stock {
  /* Keep as fallback — override only display */
  display: none;
}


/* ── Responsive Filter Bar ───────────────────────────────── */
@media (max-width: 1200px) {
  .inv-filter-select { min-width: 110px; }
}

@media (max-width: 992px) {
  .inv-adv-filter-bar { padding: 12px 14px; }
  .inv-filter-row { gap: 10px; }
  .inv-filter-select { min-width: 100px; font-size: 12.5px; }
}

@media (max-width: 768px) {
  .inv-filter-row { flex-direction: column; align-items: stretch; }
  .inv-filter-group--reset { margin-left: 0; }
  .inv-filter-select,
  .inv-filter-input { font-size: 15px; } /* Prevent iOS zoom */
  .btn-inv-reset { width: 100%; justify-content: center; }
  .inv-range-input { width: 70px; }
  #invTableWrap { max-height: none; overflow-y: visible; }
}

@media (max-width: 480px) {
  .inv-icon-btn { width: 30px; height: 30px; }
  .inv-icon-btn svg { width: 13px; height: 13px; }
  .inv-action-btns { gap: 4px; }
  .th-actions { min-width: 130px; }
}