/**
 * Inventory → tab Sản phẩm — premium layout fix (loads LAST for Kho routes).
 * Scope: body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk
 * Fixes: full-width shell, filter truncation, sticky action glitch, inline fields, density.
 */

@media (min-width: 769px) {
  /* ---- Shell: full width, scroll inside card ---- */
  body.use-new-ui.route-inventory .inventory-page #inventoryTabBody {
    width: 100%;
    min-width: 0;
  }

  body.use-new-ui.route-inventory .inventory-page #inventoryTabBody,
  body.use-new-ui.route-inventory .inventory-page .inv-product-toolbar,
  body.use-new-ui.route-inventory .inventory-page .table-wrap.product-center-table--inv-intel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  body.use-new-ui.route-inventory .inventory-page .product-center-table--inv-intel {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
    border-radius: var(--radius-xl, 24px);
    border: 1px solid var(--border-subtle, rgba(148, 163, 184, 0.14));
    background: var(--surface-table, rgba(248, 250, 252, 0.82));
    box-shadow: var(--shadow-md, 0 10px 30px rgba(15, 23, 42, 0.06));
  }

  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk {
    width: 100% !important;
    min-width: 1320px !important;
    max-width: none !important;
    table-layout: fixed !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
  }

  /* ---- Sticky action column: disabled (was overlay glitch) ---- */
  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk th.actions-col,
  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk td.product-actions-cell {
    position: static !important;
    right: auto !important;
    z-index: auto !important;
    box-shadow: none !important;
    background: inherit !important;
  }

  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk tbody tr:nth-child(even) td {
    background: rgba(248, 250, 252, 0.65) !important;
  }

  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk tbody tr:nth-child(even) td.product-actions-cell {
    background: rgba(248, 250, 252, 0.65) !important;
  }

  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk tbody tr:hover td {
    background: rgba(239, 246, 255, 0.55) !important;
  }

  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk tbody tr:hover td.product-actions-cell {
    background: rgba(239, 246, 255, 0.55) !important;
  }

  /* ---- Toolbar: filters wide enough, no truncate ---- */
  body.use-new-ui.route-inventory .inventory-page .inv-product-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
  }

  body.use-new-ui.route-inventory .inventory-page .inv-product-toolbar #productSearch {
    flex: 1 1 220px;
    min-width: 200px;
  }

  body.use-new-ui.route-inventory .inventory-page .inv-product-toolbar #productTagFilter {
    flex: 0 0 auto;
    flex-shrink: 0;
    min-width: 150px;
    width: auto;
    max-width: none;
  }

  body.use-new-ui.route-inventory .inventory-page .inv-product-toolbar #productArchiveFilter,
  body.use-new-ui.route-inventory .inventory-page .inv-product-toolbar .product-archive-filter {
    flex: 0 0 auto;
    flex-shrink: 0;
    min-width: 170px;
    width: auto;
    max-width: none;
  }

  body.use-new-ui.route-inventory .inventory-page .inv-product-toolbar input,
  body.use-new-ui.route-inventory .inventory-page .inv-product-toolbar select,
  body.use-new-ui.route-inventory .inventory-page .inv-product-toolbar .btn {
    min-height: 38px !important;
    height: 38px !important;
    font-size: 15px !important;
    border-radius: 10px !important;
    box-sizing: border-box;
    flex-shrink: 0;
  }

  body.use-new-ui.route-inventory .inventory-page .inv-product-toolbar .product-archive-filter-label {
    flex-shrink: 0;
  }

  body.use-new-ui.route-inventory .inventory-page .product-archive-filter-label {
    display: inline-flex;
    align-items: center;
    margin: 0;
  }

  /* ---- Table typography (aligned with admin table system) ---- */
  body.use-new-ui.route-inventory .inventory-page .product-center-table--inv-intel .product-stock-table--inv-desk thead th {
    padding: 10px 12px !important;
    min-height: 42px !important;
    height: auto !important;
    max-height: none !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    letter-spacing: 0.05em !important;
    text-transform: uppercase !important;
    line-height: 1.35 !important;
    vertical-align: middle !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 2 !important;
    background: #f1f5f9 !important;
    border-bottom: 1px solid rgba(226, 232, 240, 0.95) !important;
    box-shadow: 0 1px 0 rgba(226, 232, 240, 0.95);
  }

  body.use-new-ui.route-inventory .inventory-page .product-center-table--inv-intel .product-stock-table--inv-desk tbody td {
    padding: 10px 12px !important;
    min-height: 48px !important;
    height: auto !important;
    max-height: none !important;
    font-size: 15px !important;
    line-height: 1.35 !important;
    vertical-align: middle !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  body.use-new-ui.route-inventory .inventory-page .product-center-table--inv-intel .product-stock-table--inv-desk tbody tr {
    height: auto !important;
    max-height: none !important;
  }

  /* ---- Inline Danh mục / Tag ---- */
  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk .product-inline-select {
    display: block;
    width: 100% !important;
    max-width: 118px !important;
    height: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    padding: 0 28px 0 10px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    border-radius: 9px !important;
    border: 1px solid rgba(148, 163, 184, 0.22) !important;
    background-color: rgba(255, 255, 255, 0.72) !important;
    appearance: none;
    -webkit-appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position: calc(100% - 12px) 12px, calc(100% - 8px) 12px !important;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
  }

  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk .product-inline-select:focus {
    border-color: rgba(59, 130, 246, 0.45) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
    outline: none;
  }

  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk .product-inline-select[data-product-inline-field="category"][data-inline-value="Box"] {
    background-color: rgba(220, 252, 231, 0.85) !important;
    border-color: rgba(134, 239, 172, 0.65) !important;
    color: #166534 !important;
  }

  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk .product-inline-select[data-product-inline-field="category"][data-inline-value="Pack"] {
    background-color: rgba(237, 233, 254, 0.88) !important;
    border-color: rgba(196, 181, 253, 0.65) !important;
    color: #5b21b6 !important;
  }

  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk .product-inline-select[data-product-inline-field="tags"][data-inline-value="Seal"] {
    background-color: rgba(220, 252, 231, 0.85) !important;
    border-color: rgba(134, 239, 172, 0.65) !important;
    color: #166534 !important;
  }

  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk .product-inline-select[data-product-inline-field="tags"][data-inline-value="Unseal"] {
    background-color: rgba(255, 237, 213, 0.9) !important;
    border-color: rgba(253, 186, 116, 0.65) !important;
    color: #9a3412 !important;
  }

  /* Action buttons always visible (no fade from premium row-hover rule) */
  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk .product-actions-cell .btn {
    opacity: 1 !important;
  }

  /* ---- Status badges ---- */
  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk .stock-badge,
  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk .status {
    min-height: 0 !important;
    padding: 4px 10px !important;
    font-size: 13px !important;
    line-height: 1.25 !important;
    font-weight: 700 !important;
  }

  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk .product-archive-cell .small,
  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk .product-archive-cell .hydra-archived-badge {
    font-size: 13px !important;
    line-height: 1.25 !important;
  }

  /* ---- Stock inline bar ---- */
  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk .stock-cell--intel {
    text-align: right !important;
  }

  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk .stock-cell-intel {
    display: inline-flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 6px !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk .stock-qty-num {
    font-size: 15px !important;
    line-height: 1 !important;
    flex-shrink: 0;
  }

  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk .inv-stock-microbar {
    width: 44px !important;
    height: 4px !important;
    flex-shrink: 0;
    margin: 0 !important;
  }

  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk .link-like {
    font-size: 15px !important;
    line-height: 1.3 !important;
  }

  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk td.money-cell {
    padding-right: 12px !important;
    padding-left: 10px !important;
  }

  /* ---- Actions column ---- */
  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk col.product-col-actions {
    width: 204px !important;
  }

  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk th.actions-col,
  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk td.product-actions-cell {
    width: 204px !important;
    min-width: 204px !important;
    max-width: 204px !important;
    text-align: right !important;
  }

  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk .product-actions-inline {
    display: inline-flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 6px !important;
    width: auto !important;
    max-width: none !important;
  }

  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk .product-actions-cell .btn,
  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk .product-actions-cell .btn.btn-xs {
    min-height: 32px !important;
    height: 32px !important;
    max-height: 32px !important;
    padding: 0 10px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    border-radius: 8px !important;
    flex-shrink: 0;
    white-space: nowrap !important;
  }

  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk .product-actions-cell .btn.primary {
    font-weight: 650 !important;
  }

  body.use-new-ui.route-inventory .inventory-page .product-stock-table--inv-desk .product-actions-cell .btn.danger.subtle {
    padding: 0 9px !important;
  }
}
